Disable menu item but still allow key accelerator?

Does anyone know how to enable a key to still be valid in a window even
if it is assigned to a disabled menu item as an accelerator? I am using
a wxTextCtrl in a frame with an Edit menu with a "Clear" item that is
assigned the "Del" keyboard accelerator. If there is text hilited, the
Clear item is enabled and triggers an event when selected. If there is
no text hilited, the Clear item is disabled, but this apparently
prevents the Del key from working in the TextCtrl!

Thanks!

Peter Yared

Peter Yared wrote:

Does anyone know how to enable a key to still be valid in a window even
if it is assigned to a disabled menu item as an accelerator? I am using
a wxTextCtrl in a frame with an Edit menu with a "Clear" item that is
assigned the "Del" keyboard accelerator. If there is text hilited, the
Clear item is enabled and triggers an event when selected. If there is
no text hilited, the Clear item is disabled, but this apparently
prevents the Del key from working in the TextCtrl!

Accelerator keys are always stolen, but you may be able to grab it first in a EVT_KEY_DOWN attached to the textctrl. I don't remember off the top of my head if the accelerator processing happens before or after EVT_KEY_DOWN.

ยทยทยท

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