Keyboard Shortcuts and Softkeys
|
Special Function Keyboard Shortcuts
Besides common Windows functions and those in the HTBasic toolbars and menus that are accessed by keyboard shortcuts, HTBasic has additional special functions which can be invoked by keyboard shortcuts. When a keyboard shortcut (like Ctrl+C) is pressed, HTBasic internally generates a two character sequence;
CHR$(255) followed by a unique character. This means a program can also execute any function that has been assigned such a function code by outputting those two characters to the keyboard buffer (see
OUTPUT KBD). The second unique character assigned to each function is listed in the last column of the
Shortcut Key List.
Softkeys
A Softkey is a "user defined" Function key whose function can be changed under software control. Each HTBasic softkey can have four definitions (one System defined and three User defined) but only one menu is active at a time: SYSTEM, USER1, USER2 or USER3. A softkey menu is optionally displayed at the bottom of the screen with an indicator label displayed immediately above to show which menu is active. Pressing Shift+F11 (INCR LABELS) cycles through each of the four menus, while F12 directly selects SYSTEM, Shift-F12 selects USER-1, and F11 toggles the menu on and off. These same operations can be executed with the respective program statements: SYSTEM KEYS, USER n KEYS, and KEY LABELS ON/OFF. Also, pressing Alt with a Function key forces SYSTEM key function definitions to supersede any active USER Menu.
Softkey Mapping
The twelve PC keyboard Function keys F1-F12, unshifted and shifted, map to softkeys K0 to K23 (user Softkeys 0 to 23). User softkeys can be used as either keyboard macros (sometimes called "typing aids") or for generating events in a running program. By default, a user softkey acts as a keyboard macro. When you press a user softkey, one or more keystrokes that have been assigned to that key will be output to the keyboard buffer just as if you had typed them, including the function codes for common and special functions. See "
Softkey Macros".
Note that if a Function key is used in an ON KEY statement, then it is no longer active for softkey macros, but instead generates an event that triggers a GOTO, GOSUB, CALL or RECOVER.
Entering Function Codes From Keyboard
If the Ctrl key is pressed while a Function key is pressed, the Function key is not executed, but is entered into the keyboard buffer. This is useful when defining keyboard macros that expand into several key presses and when composing
OUTPUT KBD statements to execute one or more Function keys from a program.
Entering ASCII Values From Keyboard
To enter ASCII values for non-keyboard assigned characters (like "£") directly from the keyboard, hold the Alt key down while typing a number on the keypad. When you release Alt, it will automatically generate that character in a string literal, even if the character is not available on the keyboard. For example, typing 1 3 on the keypad while holding down the Alt key will insert a CHR$(13) carriage return character. If you type a leading 0, the Windows ISO 8859 Latin1 character set will be used, otherwise the OEM (code page 437) will be used. For example, Alt-(0163) enters the character "£" while Alt-(163) enters "ú". See the
ASCII Table in the Reference Manual. See also
ANY CHAR (Alt+= or Alt
+K).
Note: A null character cannot be entered from the keyboard into a string literal. Use CHR$(0) instead.
KBD CMODE Menu Styles
HTBasic supports two softkey menu layout styles that emulate legacy HP workstations. KBD CMODE OFF, the default, displays a single row of eight softkeys, and KBD CMODE ON displays a two-row by 5 key layout (total of ten softkeys) with 14 character wide labels. The labels in the menu are numbered to correspond to the dedicated keyboard Function keys. However, depending on KBD CMODE, the base softkey number can be either K0 or K1.
SCRATCH KEY command deletes softkey macros and disables their display. (This can be added to your AUTOST file.)
Print Screen
Note that you can make a screenshot of the HTBasic active window by pressing Win+Alt+PrtScn to place a "snapshot" of the HTBasic window onto the clipboard (and your Screenshots folder in Pictures). The image can then be pasted into any application. Pressing Win+Print Screen places a snapshot of the entire screen onto the clipboard (and your Screenshots folder in Pictures). Alt+PrtScn can be configured in OneDrive settings to save screenshots in OneDrive.