Doh!
You caught me guessing. I am taking a wild guess but i think it may be possible. The hard part is figuring out how to catch a second key stroke. I haven't played with STC, so I don't know it's capabilities at all. It may have a feature for this, but based on the editors implemented with it, it seems beyond it's scope.
I don't think the accelerator table ever overrides menu acclerator keys. Infact as far as I understand it, they are more or less the same thing, with the exception that wx populates the table automatically with the menuing syntax.
If I were to tackel the concept, I'd might set up an accelerator entry (not too hard but gets a little messy quick). Think you'll need a control to catch 2ndary keystrokes and get shifty with focus to make it seemless. That's kinda what emacs does with the command window at the bottom. Then usher keystrokes to whatever routine.
For key customizations, you'll need to a lookup tables/mappings. Hardwired is okay, but not what ppl generally wish for.
Here's a hardwired one i used in a picture viewer:
self.aTable = wx.AcceleratorTable([
(wx.ACCEL_ALT, ord('X'), self.controls.exitPb.GetId()),
(wx.ACCEL_NORMAL, ord('X'), self.controls.exitPb.GetId()),
(wx.ACCEL_NORMAL, wx.WXK_ESCAPE, self.controls.exitPb.GetId()),
(wx.ACCEL_NORMAL, wx.WXK_UP, self.controls.prevPb.GetId()),
(wx.ACCEL_NORMAL, wx.WXK_LEFT, self.controls.prevPb.GetId()),
(wx.ACCEL_ALT, ord('P'), self.controls.prevPb.GetId()),
(wx.ACCEL_NORMAL, ord('P'), self.controls.prevPb.GetId()),
(wx.ACCEL_NORMAL, wx.WXK_BACK, self.controls.prevPb.GetId()),
(wx.ACCEL_NORMAL, wx.WXK_DOWN, self.controls.nextPb.GetId()),
(wx.ACCEL_NORMAL, wx.WXK_RIGHT, self.controls.nextPb.GetId()),
(wx.ACCEL_ALT, ord('N'), self.controls.nextPb.GetId()),
(wx.ACCEL_NORMAL, ord('N'), self.controls.nextPb.GetId()),
(wx.ACCEL_NORMAL, wx.WXK_SPACE, self.controls.nextPb.GetId()),
(wx.ACCEL_ALT, ord('B'), self.controls.direction.GetId()),
(wx.ACCEL_NORMAL, ord('B'), self.controls.direction.GetId()),
(wx.ACCEL_ALT, ord('A'), self.controls.pause.GetId()),
(wx.ACCEL_NORMAL, ord('A'), self.controls.pause.GetId()),
(wx.ACCEL_ALT, ord('E'), self.controls.edit.GetId()),
(wx.ACCEL_NORMAL, ord('E'), self.controls.edit.GetId()),
])
#I attached same accelerators to two frames (self and controls)
self.SetAcceleratorTable(self.aTable)
self.controls.SetAcceleratorTable(self.aTable)
E. A. Tacao wrote:
···
Saturday, November 12, 2005, 9:56:24 PM, Chris Mellon wrote:
On 11/11/05, Joe Brown <joebrown@rclooke.com> wrote:
You're looking for a meta-key type functinality. I do not believe
this is possible in an "automatic" type fashion.I'm also interested on this subject because thought perhaps I could
try to implement such funcionality in Metamenus.I can confirm that it is not, but you may be able to implement it
fairly simply by using wxAcceleratorTable and adding/removing
enteries as you change states.What should I do to add/remove AcceleratorTable entries? I looked at
the docs but I couldn't find something like "AddEntry" or
"RemoveEntry".Or perhaps (I've seen meta-key implementations that work both ways)
by simply swapping out the accelerator tables entirely, and having 1
per state.If you're on an app with a menubar, swapping out the accelerator
tables entirely means that the menubar should temporarily "forget" the
accelerators previously assigned, right? I couldn't find a way to do
that -- tried to set a new accelerator table but the previous
accelerators still work.-- tacao
No bits were harmed during the making of this e-mail.
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org