Shortcut keys for dynamically created MenuItems...

G

Glenn Carr

I'm attempting to add Shortcut keys for dynamically created MenuItems,
and they simply aren't firing when the shortcut key is pressed. Here
is a snippet of the code...

....
MenuItem = new MenuItem( ... );
mi.ShowShortcut = true;
mi.Shortcut = action.Shortcut;
mi.Click += new EventHandler( action.Invoke );
miMainAction.MenuItems.Add( insertPosition++, mi );
....


Is there something I need to do to hook up these shortcut keys since I
am adding them on the fly?
 
G

Glenn Carr

Never mind.... I am an idiot.

Since the menu item isn't created until the parent menu item's popup
event, it stands to reason that the non-existent menuitem's event
wouldn't fire.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top