Mouse Events
The following section describes how Dictionary-IV will process mouse events and suggests how to modify 3GL applications to make them mouse aware.
Mouse events are trigged by posting a CTL value to a Basic INPUT statement. In some cases, a mouse event requires two INPUTs. The first receives the leading CTL value identifying the type of mouse event. The second input receives the data specific to the mouse event followed by a <CR>. The following is a summary of mouse events.
<-20> + ccc + rrr + <CR>- Left Single Click
-
<–21> + ccc + rrr + <CR>
- Left Double Click
-
HOTKEY value
- Right Single Click
-
Function-key-CTL-values
- Control Keys
-
Yes/No-character
Yes/No Prompts
Click Event
When the user clicks in the TbredComm window the host will receive:
<–20> + ccc + rrr + <CR><-20> is a CTL=-20 identifying a mouse click event.
ccc is the three-byte column position where the mouse was clicked. rrr is the three-byte row position where the mouse was clicked. <CR> is a carriage return.
Basic INPUT statements must be modified to anticipate and collect the click event. Collect the first byte from the input buffer to determine if a mouse click event has occurred (CTL=-20). If true, collect the column and row position from the input buffer. At this point the 3GL application can execute the appropriate click logic. If false, collect the remaining operator input (keystrokes) from the input buffer.
For example:
INPUT EDT (0,SIZ=1) OPERI$;! Collect 1 byte of operator input
IF CTL=-20! If mouse click event
INPUT ‘EE’,CLICK$,’BE’,! Turn echo off, collect click data, turn echo on
C=NUM(CLICK$(1,3)),! Get the click column position
R=NUM(CLICK$(4,3));! Get the click row position
GOSUB CLICK! Go process the click logic
ELSE! else
INPUT OPERI$;! Collect remaining operator input (keystrokes)
FI;! endif
Double Click Event
When the user double clicks in the TbredComm window the host will receive:
<–21> + ccc + rrr + <CR><-21> is a CTL=-21 identifying a mouse double click event.
ccc is the three-byte column position where the mouse was clicked. rrr is the three-byte row position where the mouse was clicked. <CR> is a carriage return.
Basic INPUT statements must be modified to anticipate and collect the double click event. This is similar to the click event. Please see “Click Event” above for details.
Right Mouse Click Event – HotKey Event
The right mouse click event is tied to the Basic HOTKEY directive invoking the current
HOTKEY process in Basic. For example, a right mouse click from within OPENworkshop will display the HOTKEY menu OOMU10; this is equivalent to a typing a Ctrl-P. Please refer to the Basic Language Reference manual for more information on SET HOTKEY. Please refer to the Dictionary-IV manuals for more information on the Desk Services/HotKey menu (Ctrl-P) processing.
Unlike Basic, TbredComm has no knowledge of the current SET HOTKEY value. For this reason, a right mouse click always returns a CTL-P (typically CTL=-15).
3GL applications that already take advantage of the HOTKEY directive do not require any modifictions for support of the right mouse click event. The right mouse click event simply posts the HotKey CTL value, and no additional information is posted to the input buffer.
In the following example after executing the SET HOTKEY directive, a mouse click sends a CTL=-15 to Basic. This executes the program “MYPGN”.
SET HOTKEY $10$, “MYPGN”Control Key Events Control key events are designed to work with Basic,Dictionary-IV and OPENworkshop function key prompts. For example:
Press <F1> to continueControl keys are identified by a start and ending character, for example “<>”. When the user clicks in an area encompassed by the start and end characters, the text will be interpreted. If the text contains a known control key code then that control key will be posted to the Basic INPUT statement.
In the following example clicking on the “F” or the “2” in <F2> returns CTL=2. Clicking on the “F” or the “6” in <F6> returns CTL=6. Clicking on the “F” or the “4” in <F4> returns CTL=4.
Enter: <F2> LookUp <F6> Help <F4> EndIn the following example clicking on the “F” or the “2” in (F2) returns CTL=2. Clicking on the “F” or the “6” in (F6) returns CTL=6. Clicking on the “F” or the “4” in (F4) returns CTL=4.
Enter: (F2) LookUp (F6) Help (F4) EndMultiple control key values can be defined with entries separated by commas “<>,[],{},(), F-,F=” for example.
For more information on defining control key events please see the WorkStation Manager
manual (Mouse Controls tab).
Yes/No Events
The Yes/No events are designed to work Yes/No prompts. For example:
Do you want to continue (Y/N)?The Yes No characters are identified by a start, ending character and a separator character. When the user clicks in an area encompassed by the start and end characters, the text will be interpreted. If the text matches the yes/no pattern, the clicked character will be posted to the Basic INPUT statement.
3GL applications may need to be modified. The Yes/No event will post a single character to the input buffer. For Yes/No events an INPUT SIZ=1 must be used.
In the following example clicking on the “Y” in (Y/N)? returns Y. Clicking on the “N” (Y/N)? returns N.
Do you want to continue (Y/N)?In the following example clicking on the “J” in [J-N]? returns J. Clicking on the “N” in [J-N]? returns N.
Do you want to continue [J-N]?For more information on defining Yes/No events please see the WorkStation Manager manual (Mouse Controls tab).
From the TbredComm Reference, version 8.9.1. Open this page in the PDF