[wxPython-users] Menu accelerators triggered when editing text in TextCtrl

Robin Dunn robin at alldunn.com
Sat Sep 1 18:01:12 PDT 2007


Frank Niessink wrote:
> 2007/8/28, Robin Dunn <robin at alldunn.com>:
>> Frank Niessink wrote:
>>> My app uses accelerators for things like cut, copy, paste, etc.
>>> Defined as '&Cut\tCtrl-C' etc. On Mac OSX (wxPython 2.8.4.0) these
>>> global accelerators are triggered when editing text in a dialog
>>> window, instead of the native cut, copy, paste functionality of the
>>> TextCtrl. What's the best way to prevent this from happening? Should I
>>> use an accelerator table for the mainwindow instead of the automatic
>>> accelerators or are there other options?
>> IIRC there is something in the Apple HIG that requires that the main
>> frame's Edit menu and the common clipboard menu items remain active even
>> when modal dialogs are active, and so this is why it works this way in
>> wxMac.  However I've also seen the problem you describe but was never
>> satisfied with the workarounds I tried.  I had an idea a few days ago
>> that I haven't had a chance yet to try...  Does it work if you give the
>> text widgets themselves an accelerator table?  I know that the textctrl
>> class already has EVT_MENU bindings for the standard clipboard IDs so it
>> may just work with no other effort on your part, as long as they are
>> able to get the menu events from the accelerators.
> 
> I tried: self.SetAcceleratorTable(wx.AcceleratorTable([]))
> where self is the TextCtrl, but that didn't make a difference. 

Is that actually what you used or did you try with a table containing 
entries for the standard cut, copy, paste IDs?




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





More information about the wxpython-users mailing list