KeyMenu V1.04 13Mar91 Purpose: KeyMenu is an alternative to Intuition's method of menu selection via the keyboard. Intuition allows you to use the Right Amiga-Right Alt key combination along with a cursor key to move the mouse pointer anywhere on the screen. This is a simple yet flexible approach, however, if you have ever tried to use it you probably found it to be very cumbersome for menu selection. Keyboard shortcuts are ususally provided to invoke menu selections, but unless you use a particular program a lot its hard to remember all the key combinations from one program to the next. You then find yourself reaching for the mouse to see what menu options are available. With KeyMenu, all you need do is press and release the Right-Alt key and the menu for the currently active window will appear. (Note: all keys used by KeyMenu are configurable) You can then use the cursor keys to move through the menu as you choose. When you have reached the menu item you desire you can select it by pressing the return key. If you change your mind and decide not to select an item, the escape key can be used to get out of the menu without making a selection. Changes in version 1.04 - added ability to configure the numeric pad keys unique to the Amiga 2000 keyboard. - minor correction to ignore topedge specifications in menu definitions (as intuition does). Changes in version 1.03 - added an option to blank the intuition pointer when activating a menu. - KeyMenu can now coexist with 'mouse accelerator' programs without regard to what order you install them on the system. KeyMenu has been tested with dmouse, qmouse, mach and AmigaDos release 2.0 mouse accelerators. Features: - remembers the mouse pointer's location when a menu is activated and repositions the mouse at that location when the menu is exited. - remembers the menu item that mouse was positioned on the last time the menu was exited. When the menu is subsequently activated, you will be positioned on that menu item. - pressing the right mouse button while KeyMenu has a menu active allows you to override KeyMenu and take over menu operations with the mouse. - Intuition's method of using the keyboard to simulate the mouse is not hindered. In fact, the key combination of left-alt/left-amiga can be used to simulate the left mouse button while KeyMenu has a menu active. - key configuration and options can be changed at any time. - info option allows you to determine KeyMenu's key configuration and option settings at any time. - KeyMenu is completely re-entrant (pure). - compatible with all formal releases of AmigaDOS. - qualifier key(s) can be used in conjunction with the move keys to move to the first/last menu, menu item or menu subitem. Installation: Two files are required, KeyMenu and KeyMenu-Handler. KeyMenu expects the KeyMenu-Handler program to be on either the L: directory or the current directory. Other than that there are no restrictions on where these files can be placed. Usage: KeyMenu must be run from the CLI. The first time that KeyMenu is executed, it installs the KeyMenu-Handler on the system, processes any command line options that may have been specified and returns to the CLI. There is no need to use RUNBACK to execute KeyMenu, however, it won't hurt anything if you do. Subsequent executions can then be used to either change KeyMenu's configuration options or to terminate KeyMenu. The following command line options are available: QUIT terminates KeyMenu. ? provides help information about the command line options available. -i displays KeyMenu's current key configuration and option settings. This option is always processed last, i.e. after any other options that may change the configuration have been applied. -b toggles the blank intuition pointer option. When this option is used, KeyMenu replaces the intuition pointer with a transparent pointer whenever a menu is activated. The pointer is restored to its original condition when the menu is deactivated. The only indication that you have as to where you are in the menu is the highlighting provided by intuition. This can become confusing when you select a menu that contains disabled items because the disabled items do not highlight when you move over them. This option defaults to OFF. -t toggles the clear RMBTRAP flag option. The RMBTRAP flag is set by programs that wish to use the right mouse button for their own purposes rather than dedicating it to menu operations only. A good example of this is DeluxePaint. With DeluxePaint, you can use the right mouse button to draw with the background color. To do menu operations, you must move the mouse pointer into the title bar and then press the right mouse button. When DeluxePaint detects that the mouse has moved into the title bar, it clears the RMBTRAP flag in its window allowing normal menu operations to take place. This option determines what KeyMenu's action will be when you try to activate a menu and it's associated window has the RMBTRAP flag set. If this option is off, KeyMenu will not activate the menu. In the case of DeluxePaint, the mouse pointer would have to be positioned in the title bar in order to use KeyMenu. If this option is on, KeyMenu will clear the RMBTRAP flag in the window before it activates the menu. This allows KeyMenu to be used with DeluxePaint without regard to the mouse's current position. This option should be used with CAUTION. It is impossible to predict how any particular program will react to someone else clearing the RMBTRAP flag. DeluxePaint doesn't seem to mind. You might want to run KeyMenu with this option off until such time that you find an application that uses the right mouse button and that you really would like to use with KeyMenu. Then try this option making sure that you have a way of recovering if the affected application crashes. With DeluxePaint, its debatable just how useful KeyMenu is anyway in an application that is so mouse oriented. This option defaults to OFF if not specified. -p# specifies the priority, in decimal, that should be used when adding KeyMenu's input handler to the input device. This option only has effect when installing KeyMenu. You cannot change the input handler's priority once KeyMenu is installed without terminating KeyMenu and re-installing it. Intuition's input handler runs at a priority of 50. KeyMenu's input handler must be higher than Intuition's so that KeyMenu can receive the input events before Intuition does. If this option is not specified, KeyMenu's input handler will have a priority of 51. This value should be ok in almost all cases. This option is provided only for completeness and in the off chance that Intuition's input handler priority changes in some future release of AmigaDOS. Any value other than 51 should be chosen with great care. Also, see the section below about compatiblity with other input handlers. -q# defines the qualifier key(s) that can be used in conjunction with the move keys to move to the first/last menu, menu item or menu subitem where # is a decimal value as follows: 1 - Left Shift 16 - Left Alt 2 - Right Shift 32 - Right Alt 4 - Caps Lock 64 - Left Amiga 8 - Control 128 - Right Amiga Any combination of these keys may be specified by adding their respective values together or this option can be completely turned off by specifying a value of 0. When more than one qualifier key is given, KeyMenu will honor either qualifier. The various qualifier/move key combinations are interpreted as follows: Qualifier/Move Left = move to the first menu in the menu strip. Qualifier/Move Right = move to the last menu in the menu strip Qualifier/Move Up = move to the first menu item in the current menu or subitem menu. Qualifier/Move Down = move to the last menu item in the current menu or subitem menu. For example, if the mouse is positioned on the 4th item of an 8 item menu list and a qualifier of 3 was given, pressing either the Left-Shift/Cursor up or Right-Shift/Cursor up key combination will cause the mouse pointer to move to the first menu item in the list. KeyMenu defaults to the RIGHT SHIFT key if this option is not specified. -a# defines the key that will be used to activate (get into) a menu where # is a valid key code taken from the table provided below. This key is treated a little differently than the other keys used by KeyMenu. To activate a menu, the activate key must be pressed and then released without pressing any other intervening keys. This allows key combinations involving the activate key to be used by other programs without KeyMenu interfering. KeyMenu defaults to the RIGHT ALT key if this option is not specified. -e# defines the key that will be used to escape from (get out of without making a selection) a menu where # is a valid key code taken from the table below. KeyMenu defaults to the ESCAPE key if this option is not specified. -s# defines the key that will be used to select a menu item where # is a valid key code taken from the table below. KeyMenu defaults to the RETURN key if this option is not specified. -l# defines the key that will be used to move left in the menu where # is a valid key code taken from the table below. KeyMenu defaults to the CURSOR LEFT key if this option is not specified. -r# defines the key that will be used to move right in the menu where # is a valid key code taken from the table below. KeyMenu defaults to the CURSOR RIGHT key if this option is not specified. -u# defines the key that will be used to move up in the menu where # is a valid key code taken from the table below. KeyMenu defaults to the CURSOR UP key if this option is not specified. -d# defines the key that will be used to move down in the menu where # is a valid key code taken from the table below. KeyMenu defaults to the CURSOR DOWN key if this option is not specified. Valid key code values are as follows: Key Code Key Key Code Key -------- --- -------- --- 0 ` 34 V 1 1 35 B 2 2 36 N 3 3 37 M 4 4 38 , 5 5 39 . 6 6 3a / 7 7 3c Numeric Pad . 8 8 3d Numeric Pad 7 9 9 3e Numeric Pad 8 a 0 3f Numeric Pad 9 b - 40 Space Bar c = 41 Backspace d \ 42 Tab f Numeric Pad 0 43 Numeric Pad Enter 10 Q 44 Return 11 W 45 Escape 12 E 46 Delete 13 R 4a Numeric Pad - 14 T 4c Cursor up 15 Y 4d Cursor down 16 U 4e Cursor right 17 I 4f Cursor left 18 O 50 F1 19 P 51 F2 1a [ 52 F3 1b ] 53 F4 1d Numeric Pad 1 54 F5 1e Numeric Pad 2 55 F6 1f Numeric Pad 3 56 F7 20 A 57 F8 21 S 58 F9 22 D 59 F10 23 F 5a Numeric Pad ( 24 G 5b Numeric Pad ) 25 H 5c Numeric Pad / 26 J 5d Numeric Pad * 27 K 5e Numeric Pad + 28 L 5f Help 29 ; 60 Left Shift 2a ' 61 Right Shift 2d Numeric Pad 4 62 Caps Lock 2e Numeric Pad 5 63 Control 2f Numeric Pad 6 64 Left Alt 31 Z 65 Right Alt 32 X 66 Left Amiga 33 C 67 Right Amiga Compatiblity: KeyMenu has been tested with various shareware/public domain input handlers (such as QMouse, DMouse, Mach, PopCLI and WKeys) and with all versions of AmigaDos including release 2.0. Source: KeyMenu was written in assembler using Manx Aztec 68k Assembler, version 5.0d. Since KeyMenu is being placed in public domain, I tried to keep the source pretty much generic so that anyone with an assembler could assemble it. If you try to assemble the source you will have to make changes to your intuitionbase.i include file. There are 2 fields in intuitionbase that KeyMenu references, MouseX and MouseY. They exist in the C version of the include file, but not in the assembler version. I added the following lines after the field ib_FirstScreen: ULONG ib_Flags WORD ib_MouseY WORD ib_MouseX For Manx users, KeyMenu doesn't use any of the routines from c.lib. The library is used in the link step only to resolve the _LVO externals. So it doesn't matter which library, c.lib or c16.lib, that you use. The following source files are provided: keymenu.i - include file for KeyMenu keymenu-handler.i - include file for KeyMenu and KeyMenu-Handler macros.i - misc. macros for both programs keymenu.asm - source for KeyMenu keymenu-handler.asm - source for KeyMenu-Handler Public Domain: KeyMenu and all of its associated source are public domain. You can do what you choose with/to it. I would, however, like to know of any problems that you encounter or enhancements that you might like to see. Send mail to klowther on BIX if you are so inclined. I would like to thank the authors of DMouse, WKeys, QMouse etc. for making the source to their programs available. I incorporated many of their ideas in the area of input handlers and process creation. Their willingness to share their source code made writing this much easier. Ken Lowther