Key events in Popup menu

Hi
I have a popup menu and would like to "accelerate" the access

the menu items for example:

aText
bText
cText1
cText2
cText3
dText

So, I want to type a first "C" and the cText1 should be choosen, after
another "C" the cText2, ...

I tried with binding key events (EVT_CHAR, EVT_KEY_DOWN), but no
sucess (I do not get any events).

The Popup Menu lays directly under the mainframe (in fact the main
frame is not visible, only the PopUp-menu

self.menu.Bind(wx.EVT_CHAR, self.OnChar) (or self.Bind(wx.EVT_CHAR,
self.OnChar))
self.PopupMenu(self.menu)

def OnChar(self, evt):
    print "hi"
    evt.Skip()

Normal menus use “&A menu” “&B Menu” etc… to handle this. I haven’t tried it with a popup menu.

···

On Tue, May 15, 2012 at 2:48 AM, franz steinhaeusler franz.steinhaeusler@gmail.com wrote:

Hi

I have a popup menu and would like to “accelerate” the access

the menu items for example:

aText

bText

cText1

cText2

cText3

dText

So, I want to type a first “C” and the cText1 should be choosen, after

another “C” the cText2, …

I tried with binding key events (EVT_CHAR, EVT_KEY_DOWN), but no

sucess (I do not get any events).

The Popup Menu lays directly under the mainframe (in fact the main

frame is not visible, only the PopUp-menu

self.menu.Bind(wx.EVT_CHAR, self.OnChar) (or self.Bind(wx.EVT_CHAR,

self.OnChar))

self.PopupMenu(self.menu)

def OnChar(self, evt):

print "hi"

evt.Skip()

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en


Josh English

Joshua.R.English@gmail.com
http://www.joshuarenglish.com

Yes I know about that, but this isn't a solution in my case, because
more items can begin with the same letters and I want to skip over the
menu items pressing the first letter of the item.

Maybe I have to use another control, a Listctrl for example. Here I
can evaluate the keypresses (EVT_CHAR) for that.

You may have to do that. I don’t think a repetitive key-tap to select menu items is a standard interface.

···

On Wed, May 16, 2012 at 1:59 AM, franz steinhaeusler franz.steinhaeusler@gmail.com wrote:

Yes I know about that, but this isn’t a solution in my case, because

more items can begin with the same letters and I want to skip over the

menu items pressing the first letter of the item.

Maybe I have to use another control, a Listctrl for example. Here I

can evaluate the keypresses (EVT_CHAR) for that.

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en


Josh English

Joshua.R.English@gmail.com
http://www.joshuarenglish.com