I think the left Alt key is reserved for the OS.
With this key, we can :
- switch the menu on or off. (Alt + nothing)
- access to the window properties (Alt+Space)
- quit the window (Alt+F4)
- change the active task (Alt+Tab)
etc...
A way to use more 'normally' the left Alt key is in creating a menu item shortcut, targetting a specific key (ex : Q)
Code: Select all
; (once the window is created)
; (callback procedure is already created and named onKey() )
; (objects identifiers are zeroed)
; (assigning randomly a menu item identifier. Ex : $F001)
CreateMenu(0, WindowID(0) )
AddKeyboardShortcut(0, #PB_Shortcut_Alt | #PB_Shortcut_Q, $F001)
BindMenuEvent(0, $F001, @onKey() )
In this way, the key code and modifier code are 0 (zero). So, a condition can be made to get the menu item code (here EventMenu() = $F001) the shortcut has activated.
The Alt right key provides non zeroed key code and modifer code, allowing the coder to separate a left alt key from a right alt key.