[wxPython-users] Menu accelerators triggered when editing text in
TextCtrl
Frank Niessink
frank at niessink.com
Sun Sep 2 11:47:23 PDT 2007
2007/9/2, Robin Dunn <robin at alldunn.com>:
> Frank Niessink wrote:
> >
> > 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?
I had tried an AcceleratorTable with AcceleratorEntries for cut, copy
and paste (using the standard IDs) before my initial post, but that
didn't make any difference as compared to having no AcceleratorTable
at all. After your suggestion, I also tried an empty AcceleratorTable,
but that didn't work either.
In my current solution (work around), the event handler looks up the
window with focus and delegates the event handling to that window if
it's a TextCtrl:
def doCommand(self, event):
windowWithFocus = wx.Window.FindFocus()
if isinstance(windowWithFocus, wx.TextCtrl):
windowWithFocus.Cut()
else:
cutCommand = command.CutCommand(self.viewer.model(),
self.viewer.curselection())
cutCommand.do()
Cheers, Frank
More information about the wxpython-users
mailing list