Don't send the button event in idle time, just release the mouse first.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12891 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
4a61305d36
commit
df7c5d28a3
@ -67,7 +67,6 @@ class wxGenButton(wxControl):
|
||||
self.bezelWidth = 2
|
||||
self.hasFocus = false
|
||||
self.useFocusInd = true
|
||||
self.evtToSend = []
|
||||
|
||||
self.SetLabel(label)
|
||||
self.SetPosition(pos)
|
||||
@ -87,7 +86,6 @@ class wxGenButton(wxControl):
|
||||
EVT_KEY_UP(self, self.OnKeyUp)
|
||||
EVT_ERASE_BACKGROUND(self, self.OnEraseBackground)
|
||||
EVT_PAINT(self, self.OnPaint)
|
||||
EVT_IDLE(self, self.OnIdle)
|
||||
|
||||
|
||||
def SetBestSize(self, size=None):
|
||||
@ -176,14 +174,7 @@ class wxGenButton(wxControl):
|
||||
evt = wxGenButtonEvent(wxEVT_COMMAND_BUTTON_CLICKED, self.GetId())
|
||||
evt.SetIsDown(not self.up)
|
||||
evt.SetButtonObj(self)
|
||||
self.evtToSend.append(evt)
|
||||
|
||||
|
||||
def OnIdle(self, evt):
|
||||
while self.evtToSend:
|
||||
evt = self.evtToSend[0]
|
||||
del self.evtToSend[0]
|
||||
self.GetEventHandler().ProcessEvent(evt)
|
||||
self.GetEventHandler().ProcessEvent(evt)
|
||||
|
||||
|
||||
def DrawBezel(self, dc, x1, y1, x2, y2):
|
||||
@ -263,10 +254,10 @@ class wxGenButton(wxControl):
|
||||
def OnLeftUp(self, event):
|
||||
if not self.IsEnabled():
|
||||
return
|
||||
self.ReleaseMouse()
|
||||
if not self.up: # if the button was down when the mouse was released...
|
||||
self.Notify()
|
||||
self.up = true
|
||||
self.ReleaseMouse()
|
||||
self.Refresh()
|
||||
event.Skip()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user