AddKeyboardShortcut()
Syntax
AddKeyboardShortcut(#Window, Shortcut, Event)Description
Add or replace a keyboard shortcut to the specified #Window. A shortcut generates a menu event (like a menu item) as most of them are used in conjunction with menus. 'Event' is the number which will be returned by the EventMenu() function. The 'Event' value has a limited range, from 0 to 64000. By default, a window already has the #PB_Shortcut_Tab and #PB_Shortcut_Tab|#PB_Shortcut_Shift shortcuts to handle tab and shift-tab correctly trough the gadgets. A shortcut can be removed with RemoveKeyboardShortcut().
The 'Shortcut' parameter can be one of the following constants:#PB_Shortcut_Back #PB_Shortcut_Tab #PB_Shortcut_Clear #PB_Shortcut_Return #PB_Shortcut_Menu #PB_Shortcut_Pause #PB_Shortcut_Print #PB_Shortcut_Capital #PB_Shortcut_Escape #PB_Shortcut_Space #PB_Shortcut_Prior #PB_Shortcut_Next #PB_Shortcut_End #PB_Shortcut_Home #PB_Shortcut_Left #PB_Shortcut_Up #PB_Shortcut_Right #PB_Shortcut_Down #PB_Shortcut_Select #PB_Shortcut_Execute #PB_Shortcut_Snapshot #PB_Shortcut_Insert #PB_Shortcut_Delete #PB_Shortcut_Help #PB_Shortcut_0 #PB_Shortcut_1 #PB_Shortcut_2 #PB_Shortcut_3 #PB_Shortcut_4 #PB_Shortcut_5 #PB_Shortcut_6 #PB_Shortcut_7 #PB_Shortcut_8 #PB_Shortcut_9 #PB_Shortcut_A #PB_Shortcut_B #PB_Shortcut_C #PB_Shortcut_D #PB_Shortcut_E #PB_Shortcut_F #PB_Shortcut_G #PB_Shortcut_H #PB_Shortcut_I #PB_Shortcut_J #PB_Shortcut_K #PB_Shortcut_L #PB_Shortcut_M #PB_Shortcut_N #PB_Shortcut_O #PB_Shortcut_P #PB_Shortcut_Q #PB_Shortcut_R #PB_Shortcut_S #PB_Shortcut_T #PB_Shortcut_U #PB_Shortcut_V #PB_Shortcut_W #PB_Shortcut_X #PB_Shortcut_Y #PB_Shortcut_Z #PB_Shortcut_LeftWindows #PB_Shortcut_RightWindows #PB_Shortcut_Apps #PB_Shortcut_Pad0 #PB_Shortcut_Pad1 #PB_Shortcut_Pad2 #PB_Shortcut_Pad3 #PB_Shortcut_Pad4 #PB_Shortcut_Pad5 #PB_Shortcut_Pad6 #PB_Shortcut_Pad7 #PB_Shortcut_Pad8 #PB_Shortcut_Pad9 #PB_Shortcut_Multiply #PB_Shortcut_Add #PB_Shortcut_Separator #PB_Shortcut_Subtract #PB_Shortcut_Decimal #PB_Shortcut_Divide #PB_Shortcut_F1 #PB_Shortcut_F2 #PB_Shortcut_F3 #PB_Shortcut_F4 #PB_Shortcut_F5 #PB_Shortcut_F6 #PB_Shortcut_F7 #PB_Shortcut_F8 #PB_Shortcut_F9 #PB_Shortcut_F10 #PB_Shortcut_F11 #PB_Shortcut_F12 #PB_Shortcut_F13 #PB_Shortcut_F14 #PB_Shortcut_F15 #PB_Shortcut_F16 #PB_Shortcut_F17 #PB_Shortcut_F18 #PB_Shortcut_F19 #PB_Shortcut_F20 #PB_Shortcut_F21 #PB_Shortcut_F22 #PB_Shortcut_F23 #PB_Shortcut_F24 #PB_Shortcut_Numlock #PB_Shortcut_ScrollThe above key can be combined with any of the following constants:#PB_Shortcut_Shift #PB_Shortcut_Control #PB_Shortcut_Alt #PB_Shortcut_CommandNote: the #PB_Shortcut_Command constant is only useful on Mac OSX and allow to use the 'Apple' key (left or right) to define shortcuts. This constant is also supported on others OS (to ease portability), but will act like #PB_Shortcut_Control. The shortcuts Apple+Q and Apple+P, are predefined on Mac OSX for the #PB_Menu_Quit and #PB_Menu_Preferences menu entries in the application menu and cannot be reassigned.
Example:AddKeyboardShortcut(0, #PB_Shortcut_Control | #PB_ShortCut_F, 15) ; Will create a keyboard shortcut CTRL+F on the window 0 ; which will fires a menu event '15'
Supported OS
All