[wxPython-users] wx.EVT_GRID_EDITOR_HIDDEN veto not working?
Anthony Tuininga
anthony.tuininga at gmail.com
Thu Nov 1 12:00:28 PDT 2007
On 10/31/07, Robin Dunn <robin at alldunn.com> wrote:
> Anthony Tuininga wrote:
> > According to the grid simple demo (GridSimple.py) it should be
> > possible to veto hiding the editor. The code certainly seems to
> > suggest as much.
> >
> > def OnEditorHidden(self, evt):
> > if evt.GetRow() == 6 and evt.GetCol() == 3 and \
> > wx.MessageBox("Are you sure you wish to finish editing this cell?",
> > "Checking", wx.YES_NO) == wx.NO:
> > evt.Veto()
> > return
> >
> > self.log.write("OnEditorHidden: (%d,%d) %s\n" %
> > (evt.GetRow(), evt.GetCol(), evt.GetPosition()))
> > evt.Skip()
> >
> > When I run the demo, however, it asks the question and then simply
> > proceeds regardless of which option I choose. I am running the latest
> > version of wxPython (2.8.6.1) -- on Windows currently. I have seen one
> > other message (two years old) with a similar question but no response.
> > Any help on this appreciated.
>
> Heh. There's a comment at that point in the code that's been there
> since 2001, "//FIXME:add veto support". :-/ See line 8262 at
> http://svn.wxwidgets.org/viewvc/wx/wxWidgets/branches/WX_2_8_BRANCH/src/generic/grid.cpp?annotate=47330
>
> (Yes, I only gave this info because it's not my name next to that line
> of code. :-) )
Figures. ;-) I took a look at the code in question and it looks to me
like it wouldn't take much effort to implement. If I get a chance I'll
try out what I (perhaps naively) think should work and post a patch if
it does indeed work.
> > What I'm really after (just to make sure there isn't some far better
> > solution to my problem) is to verify some data, and, if invalid,
> > display a message box and continue editing.
>
> You could probably do the equivalent of the Veto by using wx.CallAfter
> to call a method that moves the cursor back to that cell and then calls
> EnableCellEditControl(True).
I'll give that a try. Its not ideal but it might be a reasonable
workaround. Thanks for the tip.
> --
> Robin Dunn
> Software Craftsman
> http://wxPython.org Java give you jitters? Relax with wxPython!
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wxPython-users-help at lists.wxwidgets.org
>
>
More information about the wxpython-users
mailing list