tips:revmedia:r69

Enhancing Mouse Functionality

Published ByDateVersionKnowledge LevelKeywords
Revelation Technologies17 OCT 19912.XINTERMEDIATEMOUSE

Advanced Revelation version 2.02 introduced mouse support. This Technical Bulletin presents a technique for enhancing the functionality of your mouse.

There are two problems that this technique helps overcome. First, the number of options available to you is limited by the number of buttons on your mouse. Second, the options are global. That is, once defined, your button definitions apply equally to all areas of the product.

Figure 1 is a example of a subroutine that addresses both problems by making context sensitive popups available when a mouse button is pressed.

The program gives you as many options as you need by calling a popup each time it is invoked. Which popup is displayed is determined by @TUTOR, the system variable used to indicate what program is being executed.

You can design your popups to suit your preferences. The program merely expects that what is returned from the popup is a string of characters that can be fed to the CONVERT.KEYSTROKES routine. Note that this means that the popups are all single selection popups.

The keystrokes will be executed just as if you had entered them manually. It is important that special keystrokes (like [F5]) be represented so CONVERT.KEYSTROKES recognizes them. The easiest way to do this is to turn on keystroke capture when you are ready to define the keystroke sequence.

Note: See chapter F11 of the main documentation set for more information on capturing keystrokes.

Keystroke capture is turned on by pressing [Ctrl–] (Control-Hyphen). Once invoked, all keystrokes will be captured until you press [Ctrl–] again.

The final step in this process is to make sure the program in Figure 1 can be executed from anywhere in the system. This is done by defining a macro set and setting up the mouse definition.

Macro sets are defined by pressing [Alt-M]. If a macro set is active, it is displayed in the window that comes up. If not, you can enter a new macro set.

Note: Chapter F11 also has additional information on macros.

In either case, find an open Macro position and enter the code S and the command MOUSE_POPUP in the appropriate fields. (The description is up to you.) Remember which keystroke invokes this option. Assume, for now, that you have assigned MOUSE_POPUP to [Alt-1].

Note: The MOUSE_POPUP routine should already be entered, compiled, and cataloged.

Now, go to the Mouse Button Definition window. You can get to the window by selecting Environment-Mouse from the Advanced Revelation main menu.

You need the following definitions:

ButtonDefinition
Left{ALT-1}
Right{CR}
Left+Right{ESC}

Now, by pressing the left button on your mouse the [Alt-1] Macro, the one that executes MOUSE_POPUP is executed.

If you decide that you do not want any of the selections on the popup, you can press the left and right buttons together to cancel the popup.

The right button is a quick way to press [Enter]. Since your popups are all single selection popups, the right button serves as your selection button.

Figure 1

EXPENDABLE SUBROUTINE MOUSE_POPUP
DECLARE SUBROUTINE CATALYST, CONVERT.KEYSTROKES

EQU SPACE$ TO \20\
EQU FALSE$ TO 0

/*
A routine that will display a popup of keystroke choices to the user. The
user selects the desired action (with the mouse) and the routine feeds the
keyboard.
*/

BEGIN CASE
  CASE @TUTOR = "WINDOW"
    CATALYST("P","POPUPS*MOUSE_POPUP")
  CASE @TUTOR = "EDIT"
    CATALYST("P","POPUPS*MOUSE_POPUP_EDIT")
  CASE @TUTOR = "POP.UP"
    CATALYST("P","POPUPS*MOUSE_POPUP")
  CASE @TUTOR[1,3] = "MW*" OR @TUTOR = "MENU"
    CATALYST("P","POPUPS*MOUSE_POPUP")
  CASE @TUTOR = "PAINT"
    CATALYST("P","POPUPS*MOUSE_POPUP")
  CASE 1
    CATALYST("P","POPUPS*MOUSE_POPUP")
END CASE

TRANSFER @ANS TO STRING
SWAP SPACE$ WITH "{SPACE}" IN STRING
BAD   = FALSE$
ERROR = FALSE$

CONVERT.KEYSTROKES(STRING, "K", BAD, ERROR)
@PLAYBACK[1,0] = STRING

RETURN
  • tips/revmedia/r69.txt
  • Last modified: 2024/06/19 20:20
  • by 127.0.0.1