event.GetPosition error for EVT_GRID_LABEL_LEFT_CLICK on wx.Grid object

I have an event handling method bound to the
gridlib.EVT_GRID_LABEL_LEFT_CLICK event. In the event handling method
I call event.GetPosition(), the X coordinate it returned is
mysteriously increased by the label width.

This can be shown clearly with the GridSimple demo that comes with the
standard docs and demo package. You will notice that upon click in the
grid row label, in the log window a quite large X coordinate is always
returned, no matter how close to the edge of the grid you click.

Is this a known bug?

Windows XP
Python 2.4.3
wxPython 2.6.3.2

···

--
Hong Yuan

大管家网上建材超市
装修装潢建材一站式购物
http://www.homemaster.cn

Yuan HOng wrote:

I have an event handling method bound to the
gridlib.EVT_GRID_LABEL_LEFT_CLICK event. In the event handling method
I call event.GetPosition(), the X coordinate it returned is
mysteriously increased by the label width.

This can be shown clearly with the GridSimple demo that comes with the
standard docs and demo package. You will notice that upon click in the
grid row label, in the log window a quite large X coordinate is always
returned, no matter how close to the edge of the grid you click.

Is this a known bug?

Not that I know of. There is an explicit add of the GetRowLabelSize()
and GetColLabelSize() values in there. I expect that it is there for
offsetting the positions of the GridWindow to be relative to the whole
Grid. But it needs to have different adjustments if the original mouse
event was on one of the label windows... I'll work up a fix.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!