Sunday, July 29, 2018

Setting the hotkey for context menu items created with the Registry

One user was experimenting with creating file context menu entries with the Registry and encountered some interesting behavior about the hotkeys for activating them with the keyboard. If multiple entries have the same hotkey (shown with the underline under a letter), pressing that letter cycles the focus through them; if the hotkey is unique, pressing it immediately activates the corresponding entry.

The hotkey for a custom entry can be set by putting an ampersand before an instance of the desired hotkey letter. Interestingly, for that to work properly, the entry's name has to be set in the default value of the entry's Registry key, not just with the key name. If an ampersand is included in the key name, the hotkey letter will be underlined, but pressing the key will do nothing.

No comments:

Post a Comment