- int sx, sy;
- wxPoint pos;
- wxString lnk;
-
- GetViewStart(&sx, &sy); sx *= wxHTML_SCROLL_STEP; sy *= wxHTML_SCROLL_STEP;
- pos = event.GetPosition();
-
- if (m_Cell)
- m_Cell->OnMouseClick(this, sx + pos.x, sy + pos.y, event);
+ SetFocus();
+ if ( m_Cell )
+ {
+ int sx, sy;
+ GetViewStart(&sx, &sy);
+ sx *= wxHTML_SCROLL_STEP;
+ sy *= wxHTML_SCROLL_STEP;
+
+ wxPoint pos = event.GetPosition();
+ pos.x += sx;
+ pos.y += sy;
+
+ wxHtmlCell *cell = m_Cell->FindCellByPos(pos.x, pos.y);
+
+ // VZ: is it possible that we don't find anything at all?
+ // VS: yes. FindCellByPos returns terminal cell and
+ // containers may have empty borders
+ if ( cell )
+ OnCellClicked(cell, pos.x, pos.y, event);
+ }