Using shortcut keys with the TreeView control

G

gary_shooter

Hi,

I'm having difficulty getting shortcut keys to work with the TreeView
control.


Using the Designer, I've added a ContextMenuStrip to the TreeView,
and
also a node-specific ContextMenuStrip to each node.


I find that the shortcut keys for the menus assigned to the nodes
don't work, while the shortcut keys for the menu assigned to the
TreeView works fine. When I say that the shotcut keys for the nodes
don't work, I mean that the corresponding menu item's click event
isn't fired unless the node's context menu is actually displayed.


Any help would be appreciated.


Thanks,
Gary
 
A

Armin Zingler

Hi,

I'm having difficulty getting shortcut keys to work with the TreeView
control.


Using the Designer, I've added a ContextMenuStrip to the TreeView,
and
also a node-specific ContextMenuStrip to each node.


I find that the shortcut keys for the menus assigned to the nodes
don't work, while the shortcut keys for the menu assigned to the
TreeView works fine. When I say that the shotcut keys for the nodes
don't work, I mean that the corresponding menu item's click event
isn't fired unless the node's context menu is actually displayed.


Any help would be appreciated.

I guess it's because a TreeNode is not a window.

You might report the problem here: (I didn't find it reported)
http://connect.microsoft.com/VisualStudio/feedback

(I not even knew you can assign a CMS to each node...)

Armin
 
J

Jeff Johnson

I find that the shortcut keys for the menus assigned to the nodes
don't work, while the shortcut keys for the menu assigned to the
TreeView works fine. When I say that the shotcut keys for the nodes
don't work, I mean that the corresponding menu item's click event
isn't fired unless the node's context menu is actually displayed.

It has never been my experience that you could use shortcut keys assigned to
context menu items without that menu being displayed (at which time, what's
the point?).

Why would you do this? It's COMPLETELY non-standard. Seriously, can you name
me any program you've ever used (that you didn't write) which shows shortcut
keys in its context menus?

I would recommend you simply trap KeyUp events and process from there.
 
J

Jeff Johnson

Why would you do this? It's COMPLETELY non-standard. Seriously, can you
name me any program you've ever used (that you didn't write) which shows
shortcut keys in its context menus?

HAHA, I just found one: Adobe Reader. (Not that I would hold that up as a
paragon of compliance to Windows standards....)
 

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