Call Box Commands
Version 2.0 15 Jan-90


CALL EV the EVENT MANAGER commands

There are 2 commands that control the Event Manager. These calls are used to get information on the system such as if a key was pressed and what it was, or what were the mouse coordinates when the button was pressed. This first call is used when the desktop in not active.

GetNextEvent

COMMAND FUNCTION DESCRIPTION
CALL EV,X,Y,B,M,K,T GET NEXT EVENT: returns the mouse coordinates, button status, modifier key code, standard key code and tick count.


X
Horizontal mouse position in GLOBAL coordinates.

Y
Vertical mouse position in GLOBAL coordinates.

B
Button status. 2 = down 0 = up

M
Modifier key code.(see Figure 2.7)

K
Keypress code equals an ASCII character value less than 128. Values greater than 128 represents a repeat key event.

T
Tick count.

To determine if a double click of the mouse has occured use CALL EV three times as follows.

10 CALL EV,X,Y,B,M,K,T : IF B <> 2 THEN GOTO 10 :REM Wait for click
20 CALL EV,X,Y,B,M,K,T1: IF B <> 0 THEN GOTO 20 :REM Wait for up
30 CALL EV,X,Y,B,M,K,T1: IF B <>2 THEN GOTO 20 :REM Wait for down

Now that the time value between mouse up and mouse down is in the variables T and T1 respectively, use the longcall command CALL LC to execute the Event Manager Function GetDblTime. GetDblTime returns the maximum difference in ticks between mouse down and mouse up events allowed for a double click.

40 CALL LC, 0\$1106\ MT: REM MT = maximum tick value.
50 IF MT > T1 - T THEN PRINT "Valid Double Click": REM double click

The value TI - T holds the time between mouse up and mouse down events obtained in lines 10,20 and 30 above. The longcall command returns the maximum allowable tick time in the variable MT. (For more information on CALL LC refer to that section in this manual.) If MT is greater then TI - T, a valid double click has occured.

TaskMaster

The second Event call is a call to TaskMaster which is to be used whenever the desktop is active ... such as when you are using windows, menus and dialogs. The TaskMaster call returns all the information that the Get Event call does but it also supplies 3 more values which return desktop region information plus double and triple clicks.

COMMAND FUNCTION DESCRIPTION
CALL EV,@,X,Y,B,M,K,T,C,D,L TASKMASTER: returns the mouse coordinates, button status, modifier key code, standard key code, tick count, code, data and click count.

Figure 2.7
Figure 2.7 Modifier key flags

Figure 2.8
Figure 2.8 TaskMaster codes


X
Horizontal mouse position in GLOBAL coordinates.

Y
Vertical mouse position in GLOBAL coordinates.

B
Button status. 2 = down 0 = up

M
Modifier key code. (see Figure 2.7)

K
Keypress code equals an ASCII character value less than 128. Values greater than 128 represents a repeat key event.

T
Tick count, This variable returns the total number of system ticks that have occured since the computer was started up.

C
TaskMaster code. (see Figure 2.8)

D
Data, if the TaskMaster code is in the system menu bar then this value would be two words the first of which is the menu bar item number and the second is the menu item number selected. Parsing these numbers goes like this:

(menu item number) = D - INT(D/65536)*65536
(menu bar item number) = INT(D/65536)

If the TaskMaster code shows that a window item was selected then D is a pointer to the window. You can derive the entity number of the window by using this value in the Get Window Pointer/ Entity Number command in the window commands.

L
Click Count, If this variable returns a 2 then a double click occured, if it's 3 then a triple click occured.