Mouse: The mouse is only supported under PCDOS. To learn how to enable the mouse see Chapter 43, "The Mouse (PCDOS Only)."
General: The user can move the highlight bar from one field to another in any of the following three ways: (1) pressing the cursor pad keys, (2) using the mouse (PCDOS only), or (3) pressing the selection character for the field. A selection character is a single designated character associated with a field. When the user types the selection character for a field, that field is selected.
When a field is active (highlighted), a menu message is displayed in the message window. The menu message can be used to tell the user more about the field. The message window is, by default, a window with no border. It uses a default video attribute and is automatically placed in the row immediately beneath the current menu.
A menu field is selected by pressing the Menu Selection key (KEY_ENTER by default), typing the selection character of the desired field (by default the first character), or clicking the left mouse button on the field. Once the menu field is selected, its associated action function is called to display the sub-menu or do some other task.
Several menu interface options are set by default:
When a user presses a key or clicks the mouse, Vermont Views searches event tables to detemine what to do. Event tables are made up of entries that associate a key press or mouse click (an event code) with an event function. There are event functions to move to the next field, move to the previous field, move to the last field on the form, move to the first field on the form, and many other actions. You can add your own event functions to provide additional functionality.
Once the menu form has been initialized and displayed, the form editor enters an event loop, waiting for the user to press a key or click the mouse. Mouse events and other events are posted in the global event queue. Keystrokes are stored in the keyboard buffer.
The form editor checks the event queue first, to see whether an event is pending. If an event is present, the editor looks up that event code in the event table and calls the associated event function. If there are no events, the editor then checks the keyboard buffer to see if a key has been pressed.
If the user has pressed a key, the editor looks up that keycode in the event tables and calls the associated event function. If no key has been pressed, the editor continues to wait for user input.
The form editor first searches for the event code in the system event table (SYSETP). If the event code is found, the appropriate function is called. If the event code is not found in the system event table, the form editor searches the form event table (FMETP) for the event code. If found, the appropriate function is called. If not found, the form editor then searches the menu field event table (Event table:MNETP). If the event code is not found, the default event table function in the menu field event table, km_chproc(), is called (that is, the event function assigned to the event code ET_DEFAULT). If the event is a key press, km_chproc() checks if the key pressed is the selection character for any of the menu fields on that form. If so, the cursor moves to that field. If not, the user hears a beep. (Sounding the bell on errors is an option and can be turned off.)
You can modify event tables by changing the event assignments. You can also write your own event functions and install them in the event table to provide the user with additional capabilities.
To see the default event code-event function assignments for the data form and field event tables look in the "Event Tables" section of the Function Reference. To learn more about modifying event tables and writing event functions, see Chapter 38, "Writing Event Functions," and Chapter 39, "Installing Event Functions and Modifying Event Tables." In addition, it is helpful to know how the form editor works and what functions you can call to assist you in moving between fields and accessing field and form information. See Chapter 29, "How Form and Menu Processing Works," and Chapter 34, "Getting and Updating Data in the Form," for this information.