Thank you Robin. I did it now and it works. But on windows ESCAPE key
doesn't work. Other keys like F1, F2 works.
···
2007/1/22, Robin Dunn <robin@alldunn.com>:
Murat Erten wrote:
> Hi,
>
> I want to do something when user hits ESCAPE key from a frame with
> a panel. I tried accelerator table like this:
>
> I have a button with an ID = wx.ID_CANCEL
>
> frame.SetAcceleratorTable(wx.AcceleratorTable([
> (wx.ACCEL_NORMAL, wx.WXK_ESCAPE, wx.ID_CANCEL),
> ]))
>
> It didn't work. Then I tried catching key down event of the panel.
> That didn't work either.
Accelerators send EVT_MENU events, so just having a button with that ID
is not enough. You also need to bind a handler for EVT_MENU with that ID.
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org
Thanks Robin, worked smoothly. If you didn't say that there was
EVT_CHAR_HOOK I wouldn't know it. They probably forgot to write it in
the docs.
···
2007/1/24, Robin Dunn <robin@alldunn.com>:
Murat Erten wrote:
>
> Thank you Robin. I did it now and it works. But on windows ESCAPE key
> doesn't work. Other keys like F1, F2 works.
It depends on the context, as ESC may be snatched for dialogs, etc. You
can try getting it with the EVT_CHAR_HOOK event.
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org
It didn't work. Then I tried catching key down event of the panel.
That didn't work either.
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org