And OnLeftClick never gets called when I left click in the grid. Is
that intended behavior?
I was trying to work around the fact that the grid cursor is not shown
unless the grid has focus...it's a bit confusing to the user, because
if they happen to click in the cell where the cursor is, when the grid
does not have the focus (even though it's not shown), the grid goes
straight to the editor, instead of just taking the focus and showing
the cursor. You can see this behavior in GridSimple.py as well.
I had hoped that I could catch the left click event and set the focus
to the grid (only when the grid does not have focus), and then eat the
click. This way, when the user clicks on the grid when it does not
have focus, it takes focus and shows the cursor, and then they can
interact.
The grid is composed of several subwindows. So if self in the code above is an instance of Grid then that won't be the actual window that the mouse events are happening in, and since mouse events are not command events then they will not propagate up to self either. Instead you should be binding it like this:
self.GetGridWindow.Bind(...)
···
On 12/12/10 7:56 PM, dhyams wrote:
In the wxpython demo (2.8.11 version of wxpython), I just added the
following bit to GridSimple.py:
...all of the binds in the __init__ method....
self.Bind(wx.EVT_LEFT_DOWN,self.OnLeftClick)
And OnLeftClick never gets called when I left click in the grid. Is
that intended behavior?
The grid is composed of several subwindows. So if self in the code above
is an instance of Grid then that won't be the actual window that the
mouse events are happening in, and since mouse events are not command
events then they will not propagate up to self either. Instead you
should be binding it like this: