Hotkeys for menu items

BlitzPlus Forums/BlitzPlus Programming/Hotkeys for menu items

Zakk(Posted 2009) [#1]
Does anyone know how to make the hotkey shortcuts show up next to menu items? (like "Edit">>>"Copy Ctrl+Z") It'd be easy enough to half-ass, I'm just curious whether there's a simpler way to do it.


GaryV(Posted 2009) [#2]
http://blitzbasic.com/bpdocs/command.php?name=HotKeyEvent&ref=gui_cat


Zakk(Posted 2009) [#3]
:/ I'd figured that much out, it's making the shortcuts appear in the menu that's the difficulty. I'd hate to have to make my own menu gadget just for that.


GaryV(Posted 2009) [#4]
http://blitzbasic.com/bpdocs/command.php?name=WindowMenu&ref=gui_cat

; Now the Edit menu
edit=CreateMenu("&Edit",0,menu) ; Main menu with Alt Shortcut - Use & to specify the shortcut key
CreateMenu "&Copy",4,edit ; Child menu with Alt Shortcut
CreateMenu "&Paste",5,edit ; Another Child menu with Alt Shortcut
CreateMenu "Cu&t",6,edit ; Another Child menu with Alt Shortcut



Anything not supported, you will need to "subclass" (whatever the B+ equivalent is) and use the API via userlibs.


Zakk(Posted 2009) [#5]
Thanks, I see it now. The answer was in the documentation for CreateMenu, sorry for the trouble.

One other question, how do you remove menu items after they have been added? Alternatively a method for reseting a menu to clear all of its sub-menus would be sufficient.


GaryV(Posted 2009) [#6]
RTFM ;)

Although I have paid somebody to write a couple of apps for me in B+, I don't own B+. Any info I am giving you is directly from the online manual ;)