I want to disable the accelerators defined in menuitem, just like
"Copy\tCtrl+C", but I still want to display them. Because I don't want
Ctrl+C can be dealed with whole frame, and only can be used in
TextCtrl. But it seems that it'll be enabled as soon as I define it in
the menu text, even if I invoke SetAcceleratorTable() with new defined
acceleratortable, it's no use at all. Does anyone know how to deal
with this?
···
--
I like python!
UliPad <<The Python Editor>>: http://code.google.com/p/ulipad/
meide <<wxPython UI module>>: http://code.google.com/p/meide/
My Blog: http://www.donews.net/limodou
thanks. But I don't want to disable the menu item. I just want to
display accelerator as a shortcut tip, and I want to deal with
accelerator mysql via SetAcceleratorTable, but not via menu item text.
···
On Mon, Mar 24, 2008 at 11:06 PM, Cody Precord <codyprecord@gmail.com> wrote:
Hello,
If you disable the menu item when it can't be used the accelerator
action will also be disabled.
Simple example:
class MyFrame(wx.Frame):
def __init__(...):
...
myMenu.Append(ID_COPY, "Copy", "Copy some text")
self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateMenu, id=wx.ID_COPY)
...
def OnUpdateMenu(self, evt):
if evt.GetId() == wx.ID_COPY:
evt.Enable(hasattr(self.FindFocus(), 'Copy'))
--
I like python!
UliPad <<The Python Editor>>: Google Code Archive - Long-term storage for Google Code Project Hosting.
meide <<wxPython UI module>>: Google Code Archive - Long-term storage for Google Code Project Hosting.
My Blog: http://www.donews.net/limodou