By way of illustration, take the following code - it's the PB Menu example with one line added to use F10 as a shortcut - and somehow substitute ] for F10.
Code: Select all
;
; ------------------------------------------------------------
;
; PureBasic - Menu example file
;
; (c) Fantaisie Software
;
; ------------------------------------------------------------
;
;
; We just have to open a window and see when an event happen on the menu
;
If OpenWindow(0, 100, 150, 195, 260, "PureBasic - Menu")
;
; Create the menu. The indent is very important here for a good lisibility
;
AddKeyboardShortcut(0, #PB_Shortcut_F10, 11)
If CreateMenu(0, WindowID(0))
MenuTitle("File")
MenuItem( 1, "&Load...")
MenuItem( 2, "Save")
MenuItem( 3, "Save As...")
MenuBar()
OpenSubMenu("Recents")
MenuItem( 5, "Pure.png")
MenuItem( 6, "Basic.jpg")
OpenSubMenu("Even more !")
MenuItem( 12, "Yeah")
CloseSubMenu()
MenuItem( 13, "Rocks.tga")
CloseSubMenu()
MenuBar()
MenuItem( 7, "&Quit")
MenuTitle("Edition")
MenuItem( 8, "Cut")
MenuItem( 9, "Copy")
MenuItem(10, "Paste")
MenuTitle("?")
MenuItem(11, "About")
EndIf
DisableMenuItem(0, 3, 1)
DisableMenuItem(0, 13, 1)
;
; This is the 'event loop'. All the user actions are processed here.
; It's very easy to understand: when an action occurs, the Event
; isn't 0 and we just have to see what have happened...
;
Repeat
Select WaitWindowEvent()
Case #PB_Event_Menu
Select EventMenu() ; To see which menu has been selected
Case 11 ; About
MessageRequester("About", "Cool Menu example", 0)
Default
MessageRequester("Info", "MenuItem: "+Str(EventMenu()), 0)
EndSelect
Case #PB_Event_CloseWindow
Quit = 1
EndSelect
Until Quit = 1
EndIf
End
The setting is a standard OpenWindow program like the simple example above and it is important for consistency with other programs that the key detection can occur across the whole window and is not bound to a gadget. So solutions for a Console (etc) are ruled out.
Any solution would probably have to be vanilla PB, as this is a Linux machine.