* Fixed toolbar button pressing - This required for HwndWrapper.NotifyParent() to be updated (to accept a new ID parameter)

This commit is contained in:
markm 2007-06-13 18:26:00 +00:00
parent a1ed80c1c5
commit 9aab1b8549
2 changed files with 18 additions and 9 deletions

@ -628,12 +628,15 @@ class HwndWrapper(object):
#
#-----------------------------------------------------------
def NotifyParent(self, message):
def NotifyParent(self, message, controlID = None):
"Send the notification message to parent of this control"
if controlID is None:
controlID = self.ControlID()
return self.Parent().PostMessage(
win32defines.WM_COMMAND,
win32functions.MakeLong(message, self.ControlID()),
win32functions.MakeLong(message, controlID),
self)
#-----------------------------------------------------------

@ -1959,14 +1959,20 @@ class ToolbarWrapper(HwndWrapper.HwndWrapper):
button_index = button_identifier
button = self.GetButton(button_index)
# transliterated from
# http://source.winehq.org/source/dlls/comctl32/toolbar.c
ret = self.SendMessageTimeout(
win32defines.TB_PRESSBUTTON,
button.idCommand,
win32functions.MakeLong(0, 1))
win32functions.WaitGuiThreadIdle(self)
time.sleep(Timings.after_toobarpressbutton_wait)
# if the button is enabled
if button.IsEnabled():
ret = self.NotifyParent(
#win32defines.TB_PRESSBUTTON,
message = win32defines.BN_CLICKED,
controlID = button.idCommand)
win32functions.WaitGuiThreadIdle(self)
time.sleep(Timings.after_toobarpressbutton_wait)