[wxPython] Patch for buttons.py

RCS-ID: $Id: buttons.py,v 1.5 2001/02/16 08:19:44 robind Exp $

I found that when I got version 1.5 of buttons.py in wxPython 2.3.0, some of
my button operation based on wxGenToggleButton was not the same as it was
with earlier versions.

I have made 3 changes to buttons.py to get it working as before:
1) Deleted all the self.evtToSend
2) Deleted the OnIdle Event handler and method
3) Added self.GetEventHandler().ProcessEvent(evt) to Notify

The diffs are:

70d69
< self.evtToSend = []
90c89
< EVT_IDLE(self, self.OnIdle)

···

---

179,185d177
< self.evtToSend.append(evt)
<
<
< def OnIdle(self, evt):
< while self.evtToSend:
< evt = self.evtToSend[0]
< del self.evtToSend[0]

I'm not sure why the OnIdle stuff was added, but delaying the processing of
the event screwed things up.

Regards,

Gordon Williams

I found that when I got version 1.5 of buttons.py in wxPython 2.3.0, some

of

my button operation based on wxGenToggleButton was not the same as it was
with earlier versions.

I have made 3 changes to buttons.py to get it working as before:
1) Deleted all the self.evtToSend
2) Deleted the OnIdle Event handler and method
3) Added self.GetEventHandler().ProcessEvent(evt) to Notify

The reason it was done this way is people had problems with the mouse still
being captured when the event was sent. Sending events later in idle time
is a common trick used in wxGTK and a bit in wxMSW to get around things like
this. In what way does your program suffer if the button event happens
after the mouse event instead of during?

Looking at the code I see that it would be easy to avoid the captured mouse
issue without idle time, but I don't recall if there were other reasons we
moved it to idle time... Does anybody object to taking out the idle
handlers here?

···

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