LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
TroyK

Ability to add keyboard shortcuts to custom right-click context menus

Status: New

When customizing application menus you can add an underscore "_" before a letter in the menu item name and it appears with an underline and is activated when you press that key.

E.g. Item name "_Edit" appears as Edit, and if you press 'e' on the keyboard it fires the shortcut menu selection event for edit.

 

However this is not the case for custom right-click context menus.

 

If you try it with a right-click menu _Edit displays as _Edit and pressing 'e' on the keyboard does nothing.

 

IDEA: Customizing the right-click context menu should function the same as customizing the application menu.

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
11 Comments
AristosQueue (NI)
NI Employee (retired)

I know of no application anywhere in the world that has shortcut keys for popup menus. It's meaningless because there's no way for the keyboard to specify where on the screen to pop up. You can add menu options that affect "all selected items" or "the diagram most closely related to the highlighted item" or something like that, but there's no way to just shortcut to a popup menu.

 

If you can find a counterexample that we could study as a prototype, that would help this idea. Maybe some other application has made this workable somehow.

Darin.K
Trusted Enthusiast
My understanding is the shortcut selects a menu item, it does not pop up the menu. A lot of lengthy right-click menus could use a shortcut or two.
TroyK
Active Participant

@Aristos Queue


Have you used GIMP lately? I'm using it right now. It has exactly what I'm requesting.

 

Perhaps you've misunderstood my request.

 

Here's an example.

 

 

This menu pops up when you right-click a layer. Notice how the first item "Edit Layer Attributes..." has the 'E' underlined. If I press 'e' while this context menu is up, hey presto, the 'Edit Layer Attributes' event fires.

 

Even Windows Explorer has similar functionality. If you select a file or folder and use the 'menu' button on the keyboard (next to the right ctrl key in case you haven't noticed it) to bring up the context menu instead of right-click you'll notice many of the items have keyboard shortcuts underlined.

 

Some people are coordinated enough to use the keyboard and mouse at the same time. Then these keyboard shortcuts in context menus become very useful.

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
TroyK
Active Participant

@Darin.K

Thank you Darin. I think you understand my suggestion.

 

I didn't think I was that cryptic.

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
RavensFan
Knight of NI

I've never used a shortcut key with a context menu.  And I was going to swear that they didn't exist for a right-click menu, after all, why would you right click something, then use a keyboard shortcut?

 

But I looked in both Excel and Word, and both of those had shortcut keys associated with items on their right click menus.

AristosQueue (NI)
NI Employee (retired)

Hm... that's more key menu navigation than keyboard shortcuts. Viable... do you know how much effort is put into making sure all the keyboard shortcut keys are under a single hand (so that the other hand can stay on the mouse)? Or is it simply the characters that are available on the words themselves?

 

I've never used these, but they seem hard to use if you have to keep switching hands on the keyboard. Am I right in that perception?

TroyK
Active Participant

I've never thought about whether the key is conveniently located on the left side of the keyboard.

 

I do know a couple of freaks who use the mouse on the left, but they get their deserved frustration in this scenario.

 

I always assumed the keys were chosen to readily represent the function they were associated with rather than convenience.

When I'm programmatically editing right-click menus, I try to keep to shortcuts the user will be familiar with (Using MS Office as the defacto standard).

 

I know some effort was made with custom QuickDrop commands here to stay on the left side of the keyboard.

 

I do use QuickDrop a lot. It's probably why I like context shortcuts. Very similar concept really.

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
Darin.K
Trusted Enthusiast

Accelerators in shortcut menus are standard in Windows, and for very good reason.  Once you know what you are doing, who really wants to right-click on something, move the mouse a mile to select something, then return to the work zone.  Accelerators allow you to select common items without leaving the spot.  Particularly useful in graphic-heavy applications (hello, LV IDE).

 

Thought experiment:  Would you rather Right-click a property-node, read through all of the selections to find the 'Change to Read/Write' item in the middle somewhere, move down to select it, then return to the original location or Right-click hit 'c' then move to the next task?  You can use the arrow keys, but that also requires focus on the menu (and good reflexes to avoid overshoot).  At least some menus are alphabetized so you can press the first letter to get in the neighborhood.

 

One side of the keyboard is a non-issue IMO.  Unlike QD, you are not typing a string of characters or using a modifier like shift or ctrl.  With a small amount of practice, one hand can cover the entire keyboard to strike a single key (hunt and peck if you will).  Better to stick with a mnemonic or Windows standard than worry about location.  QWERTY keyboards are naturally left-hand dominant (for English anyways).  What about Dvorak users?

 

I like this idea to let developers like Troy do the right thing in their applications.  Phase II is getting NI to adopt something similar.

TroyK
Active Participant

Ahhh, 'Accelerators'... is that what they're called. I wish I'd known that before I first posted the suggestion.

I've added it as a tag for the idea.

Thanks Darin.

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
BillyG
Member
 
> I know of no application anywhere in the world that has shortcut keys for popup menus.
 
 
 

Have you, perhaps, heard of MS Windows? 😉 Also, I am not sure whether this was true back in 2011, but another application that uses context menu accelerators is LabVIEW IDE... So, yes, definitely useful.

The reason I wrote this reply is because the way accelerators are implemented in LabVIEW IDE is not as intuitive as it could have been. LabVIEW does not underline any letters; instead, one may press the first letter of the menu item to jump to it, optionally followed by <Tab> to cycle through all menu items starting with the same letter. This is exactly what Darin.K described.  It works in LV 2017.

This is not quite what the OP was asking for, but it is still useful enough to share, in my opinion.