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:
@@ -67,7 +67,6 @@ class wxGenButton(wxControl):
|
|||||||
self.bezelWidth = 2
|
self.bezelWidth = 2
|
||||||
self.hasFocus = false
|
self.hasFocus = false
|
||||||
self.useFocusInd = true
|
self.useFocusInd = true
|
||||||
self.evtToSend = []
|
|
||||||
|
|
||||||
self.SetLabel(label)
|
self.SetLabel(label)
|
||||||
self.SetPosition(pos)
|
self.SetPosition(pos)
|
||||||
@@ -87,7 +86,6 @@ class wxGenButton(wxControl):
|
|||||||
EVT_KEY_UP(self, self.OnKeyUp)
|
EVT_KEY_UP(self, self.OnKeyUp)
|
||||||
EVT_ERASE_BACKGROUND(self, self.OnEraseBackground)
|
EVT_ERASE_BACKGROUND(self, self.OnEraseBackground)
|
||||||
EVT_PAINT(self, self.OnPaint)
|
EVT_PAINT(self, self.OnPaint)
|
||||||
EVT_IDLE(self, self.OnIdle)
|
|
||||||
|
|
||||||
|
|
||||||
def SetBestSize(self, size=None):
|
def SetBestSize(self, size=None):
|
||||||
@@ -176,14 +174,7 @@ class wxGenButton(wxControl):
|
|||||||
evt = wxGenButtonEvent(wxEVT_COMMAND_BUTTON_CLICKED, self.GetId())
|
evt = wxGenButtonEvent(wxEVT_COMMAND_BUTTON_CLICKED, self.GetId())
|
||||||
evt.SetIsDown(not self.up)
|
evt.SetIsDown(not self.up)
|
||||||
evt.SetButtonObj(self)
|
evt.SetButtonObj(self)
|
||||||
self.evtToSend.append(evt)
|
self.GetEventHandler().ProcessEvent(evt)
|
||||||
|
|
||||||
|
|
||||||
def OnIdle(self, evt):
|
|
||||||
while self.evtToSend:
|
|
||||||
evt = self.evtToSend[0]
|
|
||||||
del self.evtToSend[0]
|
|
||||||
self.GetEventHandler().ProcessEvent(evt)
|
|
||||||
|
|
||||||
|
|
||||||
def DrawBezel(self, dc, x1, y1, x2, y2):
|
def DrawBezel(self, dc, x1, y1, x2, y2):
|
||||||
@@ -263,10 +254,10 @@ class wxGenButton(wxControl):
|
|||||||
def OnLeftUp(self, event):
|
def OnLeftUp(self, event):
|
||||||
if not self.IsEnabled():
|
if not self.IsEnabled():
|
||||||
return
|
return
|
||||||
|
self.ReleaseMouse()
|
||||||
if not self.up: # if the button was down when the mouse was released...
|
if not self.up: # if the button was down when the mouse was released...
|
||||||
self.Notify()
|
self.Notify()
|
||||||
self.up = true
|
self.up = true
|
||||||
self.ReleaseMouse()
|
|
||||||
self.Refresh()
|
self.Refresh()
|
||||||
event.Skip()
|
event.Skip()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user