[wxPython-users] tell if gridevent (wx.EVT_GRID_SELECT_CELL)
originated from user
Eric Ongerth
ericongerth at gmail.com
Mon Jun 4 10:05:59 PDT 2007
On 6/4/07, Robin Dunn <robin at alldunn.com> wrote:
>
> Eric Ongerth wrote:
> > Let's say I have a grid event (wx.EVT_GRID_SELECT_CELL) and I want to
> > determine whether it came from the keyboard (i.e. was initiated by the
> > user) or not.
> >
> > Why am I asking? Well, most of the time if such an event passes by, it
> > IS because the user selected a cell. However, if I clear my grid table
> > (this is with a wx.PyGridTableBase) and then add a single row back into
> > it, notify the grid of the change and refresh the grid, the grid seems
> > to say "hey, there's only one row in me. It must be the selected row!"
> > -- thus it generates a wx.EVT_GRID_SELECT_CELL.
> >
> > Unfortunately, I'm binding EVT_GRID_SELECT_CELL to a method that
> > populates a bunch of fields in a window, and I don't want those fields
> > populated automatically if the above chain of events happened. I only
> > want it populated if the user actually selected a cell, not by the
> > "default select" of the table having only one row.
>
> The way this is usually handled is to set some flag before you do the
> thing that results in an induced event, and in the event handler check
> the status of that flag and just return immediately if it is set.
Thanks, Robin. That's what I've been doing today; good to know I'm on
track.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/200706=
04/631b2261/attachment.htm
More information about the wxpython-users
mailing list