Introduction MTB Statements File System Compiler Applications Reference Guide Index

Language Structure Data Division I/O Format Division Procedure Division Mnemonics

(Easy Scan)

Mnemonic: (Easy Scan)
Hex equivalent: "@0E0000@"
Discussion: The (Easy Scan) mnemonic places the Comet console into "easy scan" mode. (This mnemonic does not apply to QTerm or terminals.)

In "easy scan" mode, if the user presses one of the recognized keys while the program is at an INPUT prompt, the program responds as if an F10, Enter, or Tab key was pressed. In combination with the returned screen coordinates (see INPUT), this feature allows for an enriched style of screen I/O programming.

In addition, if the mouse driver is active (see the (Mouse On) mnemonic), a mouse click also generates a transmit, and places the cursor's coordinates in the status buffer (see Example 2). Starting with Comet98 Build 232, (Easy Scan) turns the mouse on if it is not already being done. **

The (Scan Codes Off) mnemonic terminates "easy scan" mode.

The "reason for transmit" information is stored in the 8th byte of the console's status buffer, and is stored in hex. To determine which key (or click) caused the transmit to occur, perform the following operation:

VALUE = ASC(SUB(STS(0),8,1))

Note: VALUE is a numeric field with length/precision of 3.0.

The following values are returned:

Value Key that caused the transmit to occur
4 Up arrow
5 Down arrow
6 Left mouse click
7 * Ctrl + Home
8 * Ctrl + End
9 * Pg Up
10 * Ctrl + Pg Up
11 * Pg Dn
12 * Ctrl + Pg Dn
14 Right mouse click

Values 1, 2, and 3 are generated via the INPUT statement, and do not require the (Easy Scan) mnemonic.

History: The (Easy Scan) mnemonic was added in Comet version 504.208 as part of the enhanced INPUT statement.

* Values 7 through 12 were added in Comet 504.228 and Comet98 Build 228.

** Starting with Comet98 Build 232, (EasyScan) turns the mouse on if it is not already being done. If it is already on, it is assumed the whoever turned it on will also turn it off.

Starting with Build 292, (EasyScan) disables any scan modes that are currently enabled.

Value 14 was added in Build 294.

As of Build 294, (EasyScan) mouse clicks now occur on the up-click instead of the down-click. This is consistent with other Windows applications.

Example 1:
PRINT (0) (Mouse On)             ! Mouse on (optional)
.
PRINT (0) (Easy Scan)            ! Easy scan mode on
.
.
.
INPUT (0) DATA$                  ! Input a field

VALUE = ASC(SUB(STS(0),8,1))     ! Reason for transmit

IF VALUE = 1 ...                 ! F10 key 
IF VALUE = 2 ...                 ! Enter key
IF VALUE = 3 ...                 ! Tab key
IF VALUE = 4 ...                 ! Up arrow
IF VALUE = 5 ...                 ! Down arrow
IF VALUE = 6 ...                 ! Left mouse click
IF VALUE = 7 ...                 ! Ctrl + Home
IF VALUE = 8 ...                 ! Ctrl + End
IF VALUE = 9 ...                 ! Pg Up
IF VALUE = 10 ...                ! Ctrl + Pg Up
IF VALUE = 11 ...                ! Pg Dn
IF VALUE = 12 ...                ! Ctrl + Pg Dn
IF VALUE = 14 ...                ! Right mouse click
.
.
.
PRINT (0) (ScanCodesOff)         ! Easy scan mode off
PRINT (0) (Mouse Off)            ! Mouse driver off
Example 2:
Data$ = Sub(Sts(0), 1, 254)      ! Get console status
J = Asc(Sub(Data$, 8, 1))        ! Get "reason for transmit"
If (J EQ 6)                      ! Mouse was clicked
  Row = Asc(Sub(Data$, 15, 1))   ! Get the row
  Col = Asc(sub(Data$, 16, 1))   ! Get the column
Endif
This example shows how to determine the cursor's coordinates when the mouse is clicked.