home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 3 Comm
/
03-Comm.zip
/
tt2man.zip
/
ttautod.doc
< prev
next >
Wrap
Text File
|
1993-12-13
|
52KB
|
1,368 lines
TABLE OF CONTENTS
C. Appendix C - AUTOPILOT Migration From DOS
C.1 Overview
C.2 Support For DOS PC Screen Statements
C.3 DOS Compatible Statements And Functions
C.3.1 CLS Statement
C.3.2 COLOR Statement
C.3.3 CREATE TEXT_WINDOW Statement
C.3.4 DISPLAY Statement
C.3.5 KEYBOARD_INFO Function
C.3.6 KEYBOARD_POLL Function
C.3.7 LOCATE PC_CURSOR Statement
C.3.8 MOUSE_INFO Function
C.3.9 MOUSE_POLL Function
C.3.10 ON Statement
C.3.11 PC_CURSOR_COLUMN Function
C.3.12 PC_CURSOR_ROW Function
C.3.13 PC_KEY Function
C.3.14 PC_SCREEN Function
C.3.15 PC_SCREEN_CHARATTR Function
C.3.16 PROMPT Statement
C.3.17 RESUME Statement
C.3.18 SET Statement
C. Appendix C - AUTOPILOT Migration From DOS
C.1 Overview
One of the main design objectives in developing AUTOPILOT for OS/2 was the
easy migration of AUTOPILOT applications developed under DOS. Because of
the differences in the environments, though, this goal was not absolutely
obtained. Below is a list of some of the considerations regarding this:
1. The OS/2 environment offers a graphical, multi-sessioning environment
entirely foreign to standard DOS. The AUTOPILOT DOS product contains
numerous Statements and Functions which:
- deal with the PC Screen as a fixed font, 80 column, 25 row screen
- sense the keyboard
- sense the mouse
ALL of these Statements and Functions still function under OS/2 but not
in a manner totally integrated with the new environment. If you wish to
continue to use these Statements and Functions, they are described in
detail in the next section, Support For DOS AUTOPILOT Statements.
2. ALL AUTOPILOT communications under OS/2 are supported through the
EHLLAPI interface. Therefore, ALL communications Statements except
those dealing with the DOS EHLLAPI environment, are no longer valid.
This includes support for the EMULATE Statement. To identify the
communications environment under OS/2, the CONNECT Statement MUST BE
used.
3. Since all communications are through EHLLAPI, the EXIT HOLD Statement
has no function.
4. The DOS RUN DOS Statement is now a RUN SYSTEM Statement.
C.2 Support For DOS PC Screen Statements
Since AUTOPILOT was originally developed under PC/DOS, it contains a wide
variety of functions which assume a PC/DOS Screen. So as to provide
compatibility and portability between OS/2 and PC/DOS, AUTOPILOT
applications are, by default, provided a Presentation Manager window the
exact size of a PC Screen (80 Columns/25 Rows). A fixed font is utilized so
that Row/Column coordinates are consistent throughout the window. Also,
where PC/DOS Screen field attributes are referenced in the AUTOPILOT
syntax, AUTOPILOT automatically translates the OS/2 field display
attributes to be compatible.
Therefore, the AUTOPILOT Statements And Functions described in this
appendix, although originally intended for use in the PC/DOS environment,
are perfectly acceptable and functional under OS/2 without losing the
benefits of multi-tasking and aesthetics provided by the Presentation
Manager. They are discussed separately from the other AUTOPILOT Verbs and
Functions so as to simplify your use of AUTOPILOT in building Presentation
Manager Dialog Windows. The Dialog Windows discussed in the AUTOPILOT
Statement Reference chapter will be used for the majority of applications
you develop for OS/2.
The functions available to your AUTOPILOT program for interacting with OS/2
and the Presentation Manager window in a DOS Compatibility Mode include:
- Creating and supporting a Presentation Manager based text window with a
fixed font which will emulate the PC Screen in the DOS environment.
- Establishing foreground and background colors for the display.
The following functions provide information when the AUTOPILOT window has
the FOCUS.
- Prompting for keystrokes or text information from the keyboard.
- Polling the keyboard to see if keystrokes are available, thus allowing
other processing to occur during keyboard entry.
- Polling the status of the MOUSE to determine current MOUSE position
(row/column) and the position of the left and right buttons.
C.3 DOS Compatible Statements And Functions
┌─────────────────────┐
│ C.3.1 CLS Statement │
└─────────────────────┘
Purpose:
Clears the window.
Format:
┌──────────────────────────────────────────────────────────────────────┐
│ CLS │
│ │
│ CLS [ FROM <row> <col> [TO <row> <col> ] ] │
└──────────────────────────────────────────────────────────────────────┘
Remarks:
The CLS Statement clears the window to the background color specified in
a previous COLOR Statement (see COLOR Statement in this chapter). If no
COLOR Statement has been issued, the default window color is used.
The CLS Statement also returns the cursor to the home position (upper
left-hand corner of the screen).
The CLS Statement with the FROM clause may be used to clear a portion of
the screen. The portion cleared is defined as a rectangle starting at the
FROM position and going to the TO position. If the TO position is not
specified, the end of the screen is used (25,80).
Examples:
CLS
The above example clears the entire screen.
CLS FROM 1, 60 TO 5, 80
In the above example of the CLS statement with the FROM clause, the
result would be to clear the last 20 columns of the first 5 lines on the
screen.
See Also:
COLOR
DISPLAY
┌───────────────────────┐
│ C.3.2 COLOR Statement │
└───────────────────────┘
Purpose:
Set the foreground and background colors and optionally modify the color
on a portion of the window.
Format:
┌──────────────────────────────────────────────────────────────────────┐
│ COLOR [<foreground> [,<background>]] │
│ [FROM <row> <col> [TO <row> <col> ] ] │
└──────────────────────────────────────────────────────────────────────┘
Remarks:
<foreground> and <background> are numbers in the range 0 to 15 which
represent the colors to be used.
When the FROM/TO clause IS NOT specified, the COLOR Statement is used to
control the use of foreground and background colors within the CLS,
DISPLAY, and PROMPT Statements.
CLS, DISPLAY, and PROMPT Statements that follow a COLOR Statement will
use the new foreground and background setting until another COLOR
Statement is encountered.
The foreground and background colors on the current display are not
affected until a subsequent CLS, DISPLAY, or PROMPT Statement is issued.
When the FROM/TO clause IS specified, the color in the rectangle
specified by the FROM/TO range is modified immediately. The FROM/TO
clause WILL NOT modify the color usage in subsequent CLS, DISPLAY, or
PROMPT Statements. If the TO clause is not specified, the end of the
window is assumed.
Examples:
Example 1:
All the options on the COLOR Statement are optional. If they are not
specified, the current color setting is not changed. For example:
COLOR 2,7
- changes the foreground and background colors
COLOR 2
- changes the foreground color only
COLOR ,7
- changes the background color only
Example 3:
If the COLOR Statement is specified without any options, the foreground
and background border colors are set to the default window color.
Example 4:
With a Color Graphics Monitor
With a color graphics monitor adapter the following colors are displayed:
0 Black 8 Gray
1 Blue 9 Light Blue
2 Green 10 Light Green
3 Cyan 11 Light Cyan
4 Red 12 Light Red
5 Magenta 13 Light Magenta
6 Brown 14 Yellow
7 White 15 High Intensity White
See Also:
CLS
┌────────────────────────────────────┐
│ C.3.3 CREATE TEXT_WINDOW Statement │
└────────────────────────────────────┘
Purpose:
The CREATE TEXT_WINDOW Statement is used in the OS/2 environment to
define a Presentation Manager window to display fixed font textual
information. This Statement is primarily used to provide upward
compatibility for AUTOPILOT applications created under PC/DOS or MS/DOS.
Format:
┌──────────────────────────────────────────────────────────────────────┐
│ CREATE TEXT_WINDOW <window-number> │
│ [ VISIBLE | INVISIBLE ] │
│ [ ENABLED | DISABLED ] │
│ [ MINIMIZED | MAXIMIZED ] │
│ [ ESCAPE <label> ] │
│ [ KEY <keylist> <label> ] │
│ [ TITLE_BAR <title-string> ] │
│ [ BORDER <bordertype ] │
│ [ ICON <iconfilespec> ] │
│ [ TASK_LIST ] │
│ [ SYSTEM_MENU ] │
│ [ MINIMIZE_BUTTON ] │
│ [ MAXIMIZE_BUTTON ] │
│ [ HORIZONTAL_SCROLL_BAR ] │
│ [ VERTICAL_SCROLL_BAR ] │
│ [ DEFAULT_COLOR <fgnd> [,] <bkgnd ] │
│ [ TEXT_SIZE <rows> [TEXT_ROWS ] [,] │
│ <cols> [TEXT_COLUMNS ] ] │
│ │
│ [ WINDOW_SIZE <rows> [ { TEXT_ROWS } ] │
│ [ { DEVICE_ROWS } ] │ │
│ [ { DIALOG_ROWS } ] [,] │
│ <cols> [ { TEXT_COLUMNS] } ] │
│ [ { DEVICE_COLUMNS } ] │
│ [ { DIALOG_COLUMNS } ] │
│ [ WINDOW_POSITION [ DEVICE_ROW[S] ] <row> [,] │
│ [ DEVICE_COLUMN[S] ] <col> ] │
│ [ ACTION <label> ] │
│ [ ACTION_BAR_MENU clause ] │
│ [ FONT clause ] │
│ END_CREATE │
└──────────────────────────────────────────────────────────────────────┘
Remarks:
The CREATE TEXT_WINDOW Statement is used to define a Presentation Manager
text window. Multiple CREATE Statements can be used in a single
AUTOPILOT program. To indicate which text window is current, use the SET
CURRENT_WINDOW Statement.
<window-number>
may be either:
1. An integer expression such that 0 < <window-number> < 100.
2. A Symbol set to zero. If this is the case, the symbol will be set to
a free window number.
VISIBLE/INVISIBLE
The initial visibility state of may be set by the VISIBLE or INVISIBLE
keyword. The default is VISIBLE. The visibility state may be changed
after window creation by using the SHOW TEXT_WINDOW Statement.
ENABLED/DISABLED
The initial selectability state of the TEXT_WINDOW may be set by the
ENABLED or DISABLED keyword. The default is ENABLED. The selectability
state may be changed after window creation by using the ENABLE
TEXT_WINDOW or DISABLE TEXT_WINDOW Statements. If a TEXT_WINDOW is
DISABLED, it will not receive focus.
MINIMIZED/MAXIMIZED
The initial size of the window may be set by the MINIMIZED or MAXIMIZED
clause. The default is neither -- the initial size of the window is set
by the WINDOW_SIZE clause. The MINIMIZE or MAXIMIZE Statement can be
used after window creation to change this state.
ESCAPE
The ESCAPE clause may be used to initially set the ESCAPE handling
routine. It may be changed after window creation by using the ON ESCAPE
command.
KEY <key<E>list>
The KEY clause may be used to set KEY trapping handling routines. It may
be changed or added to after window creation by using the ON KEY
command. <keylist> is a list of scan codes for PC keys which should be
recognized. By INCLUDEing the file TT_PCKEY.INC in your AUTOPILOT
program, you may refer to the keys by name (i.e. _F1, _F12, etc.).
<label> is the label of a routine in your AUTOPILOT program to receive
control when the specified key(s) pressed.
TITLE_BAR
Adds a title bar to the window. <title-string> is required but may be
set to "". If the TITLE_BAR clause is not included, no title bar will
be included.
BORDER
Determines the type of border the window will have. <bordertype> may be:
0 - No border
1 - Size border
2 - dialog border
3 - Standard border
If this clause is not included, the window will have no border.
ICON
Sets the window's icon to the icon specified by <iconfilespec>. The
default directory for the icon is set by the ICON_DIRECTORY
Customization Variable. This variable may be viewed or modified by
selecting System Configuration from the Utilities Pull Down Menu on any
Phone Book. If this clause is not specified, the icon will be set to one
of the standard OS/2 icons by the window procedure.
MSGLINE
Sets the windows message line. The message line is where DISPLAY and
PROMPT Statements are directed if no AT clause is specified (the entire
line is erased first). If MSGLINE is set to zero, the displays and
prompts start at the position where the last display/prompt ended.
TASK_LIST
A window may put itself on the OS/2 Task List by using the TASK_LIST
clause. By default, the window WILL NOT be put on the Task List.
SYSTEM_MENU
MINIMIZE_BUTTON
MAXIMIZE_BUTTON
HORIZONTAL_SCROLL_BAR
VERTICAL_SCROLL_BAR
Includes the specified component in the window. If the keyword is not
specified, the component is not included.
DEFAULT_COLOR
Establishes the default color for a window (i.e. The color that text
will appear if there are no COLOR Statements).
In addition, this statement effectively defines the background color for
that portion of a window that is displayed that exceeds the TEXT_SIZE
area.
If not specified, the default color is black on white (0,15)
TEXT_SIZE
Defines a text region size.
The text region is the area of the window that can be modified by the
DISPLAY, PROMPT, COLOR, etc. Statements.
The default and only valid coordinate types are TEXT_ROWS and
TEXT_COLUMNS (see Coordinate System discussed under CREATE
DIALOG_WINDOW).
WINDOW_SIZE
Defines the window size
The default coordinate type is TEXT_ROWS and TEXT_COLUMNS. Valid
coordinate types are TEXT_ROWS, TEXT_COLUMNS, DIALOG_ROWS,
DIALOG_COLUMNS, DEVICE_ROWS, and DEVICE_COLUMNS (see Coordinate System
discussed under CREATE DIALOG_WINDOW in the Chapter, AUTOPILOT Statement
Reference).
WINDOW_POSITION
Defines the window position relative to its parent.
The default and only valid coordinate types are DEVICE_ROW[S] and
DEVICE_COLUMN[S] (see Coordinate System discussed under CREATE
DIALOG_WINDOW in the Chapter, AUTOPILOT Statement Reference).
ACTION
Allows you to specify a label in your AUTOPILOT program to receive
control if one of the following conditions are true:
1. The SYSTEM MENU Item Close is requested.
2. A PULLDOWN is requested (see ACTION_BAR_MENU clause under the CREATE
DIALOG_WINDOW Statement) with no associated ACTION.
3. A CHOICE is requested (see ACTION_BAR_MENU clause under the CREATE
DIALOG_WINDOW Statement in the Chapter AUTOPILOT Statement
Reference) with no associated ACTION and no associated PULLDOWN
ACTION.
See the discussion under the CREATE DIALOG_WINDOW Statement in the
Chapter, AUTOPILOT Statement Reference on the ACTION_BAR_MENU clause for
more information on PULLDOWN and CHOICE ACTIONs.
ACTION_BAR_MENU
See the discussion on the ACTION_BAR_MENU clause under CREATE
DIALOG_WINDOW in the Chapter, AUTOPILOT Statement Reference for more
information on the format and processing provided.
FONT <font-specification>
The FONT clause allows you to specify an alternate font to be used by
this text window. By default, AUTOPILOT will use the TalkThru default
font (currently the TalkThru 7x10 fixed font) for any TEXT_WINDOW
created. The format of this clause is:
┌──────────────────────────────────────────────────────────────────────┐
│ FONT [ FACENAME = <face> ] │
│ [ SIZE=<size> ] │
│ [ CODEPAGE=<cp> ] │
│ [ BOLD ] │
│ [ ITALICS ] │
│ [ UNDERLINE ] │
│ [ STRIKE OUT ] │
└──────────────────────────────────────────────────────────────────────┘
FACENAME=<face> selects the font. It may be a TalkThru font or any
public fixed space font such as Courier or System Monospaced. If
FACENAME is not specified it defaults to TalkThru.
SIZE=<size>is used to specify the size of the font. It can be specified
as wXh where w is the width in pels and h is the height in pels
(example: SIZE=7x10 or SIZE=8X13). The keywords SMALL, MEDIUM, LARGE may
also be used (example SIZE=LARGE). The use of these keywords will insure
that the font is about the same size regardless of display resolution.
The default is SIZE=SMALL.
CODEPAGE=<cp> can be used to select a specific codepage for a window.
For example CODEPAGE=850 or CODEPAGE=437. The default ,codepage for a
window is the default codepage for the system.
One or more of the attributes BOLD, ITALICS, UNDERLINE, and STRIKEOUT
can be used to modify the appearance of the font. By default, none of
these attributes are included. (Note: the use of BOLD will slightly
increase the size of the font).
See Also:
SET DEFAULT_COLOR
Also, see the following statements discussed in the Chapter, AUTOPILOT
Statement Reference.
ACTION_WINDOW
ACTION_TYPE
ACTION_ID
ADD TO
CLOSE
DISABLE
ENABLE
HIDE
MINIMIZE/MAXIMIZE/RESTORE
OPEN
REMOVE FROM
RESUME ACTION
SHOW
SET PULLDOWN
SET CHOICE
SET TITLE_BAR
SET WINDOW_SIZE
SET WINDOW_POSITION
SET CURRENT_WINDOW
WAIT FOR ACTION
┌─────────────────────────┐
│ C.3.4 DISPLAY Statement │
└─────────────────────────┘
Purpose:
Displays information on the window.
Format:
┌──────────────────────────────────────────────────────────────────────┐
│ DISPLAY [CHARATTR] <text> │
│ [AT <row> <col>] │
│ [FROM <row> <col> [ TO <row>] ] │
│ [, <text> │
│ [ AT <row> ] │
│ [ FROM <row> <col> [ TO < row> <col> ] ] ] │
└──────────────────────────────────────────────────────────────────────┘
Remarks:
CHARATTR
is a keyword indicating that <text> is a variable created using the
PC_SCREEN CHARATTR Function and contains PC Video data for
redisplay on the window.
<text>
is a string value that contains the characters to be displayed.
<row>
is a number in the range 1 to n (where n is 25 or the number of lines
indicated in the CREATE TEXT_WINDOW Statement). It indicates the
window line number where the text is to be displayed.
<col>
is a number in the range 1 to n (where n is 80 or the number of lines
indicated in the CREATE TEXT_WINDOW Statement. It indicates the
screen column number where the text is to be displayed.
The value of <text> is displayed on the window.
If the optional AT clause is omitted, the text will be displayed at the
location specified by MSGLINE. (See the SET Statement). The entire line
will be cleared prior to displaying the text. If MSGLINE = 0, then the
display will start where the last DISPLAY or PROMPT ended.
MSGLINE = 0 is the default if the window was created with CREATE
TEXT_WINDOW, but MSGLINE = 25 is the default for the PC/DOS compatibility
window.
If the AT clause is specified, the text will be displayed at the
indicated position and the line will be cleared ONLY for the length of
<text>.
If the FROM/TO clause is specified, <text> will be displayed in the form
of a rectangle formed by the FROM/TO coordinates. If the TO clause is
not specified, it defaults to the end of the screen. If <text> is not big
enough to fill the rectangle, it is replicated; if it is too big, it is
truncated.
Multiple <text> values can be displayed with a single DISPLAY verb by
separating them by a comma. This improves the speed of the overall
display process.
Examples:
Example 1:
This example displays "Creating Extract" on line 25. Prior to the
display, line 25 is erased.
DISPLAY "Creating Extract"
Example 2:
This example displays the contents of identifier user_name at the row
indicated by the value of identifier r_val and column 1.
DISPLAY user_name at r_val , 1
Example 3:
This example displays a rectangle defined by a capital X. The rectangle
will go from row 10 column 40 to row 15 column 50.
DISPLAY "X" FROM 10 40 TO 10 50 ,
"X" & str_replicate(" ",9) & "X" FROM 11 40 TO 14 50 ,
"X" FROM 15 40 TO 15 50
Example 4:
This example will save a portion of the window defined by the rectangle
from row 10, column 40 to row 15, column 50 and redisplay it later in the
program.
set t_screen = PC_SCREEN_CHARATTR(10,40,15,50)
.
.
.
refresh:
display CHARATTR t_screen FROM 10 , 40 TO 15 ,~5 0
See Also:
CLS
COLOR
PC_SCREEN
PC_SCREEN_CHARATTR
┌──────────────────────────────┐
│ C.3.5 KEYBOARD_INFO Function │
└──────────────────────────────┘
Purpose:
To return the current status of the PC keyboard.
Format:
┌──────────────────────────────────────────────────────────────────────┐
│ KEYBOARD_INFO(<request>) │
└──────────────────────────────────────────────────────────────────────┘
Remarks:
Returns a value depending on the <request>. This function can be used to
"POLL" the PC keyboard without having to issue the PROMPT Statement.
The INCLUDE file TT_PCKEY.INC has been provided containing global equates
to the possible <request> values. Below is a table indicating the
possible <request> values, the global equates and their meanings:
Request Global Equate Meaning
─────── ───────────── ──────────────────────────────────────────────────
0 KBDTYPE 1 - extended keyboard is present
0 - keyboard is not extended
1 KBDBIOS Returns the next BIOS scan code/character code
from the keyboard buffer (the keystroke is
removed from the buffer).
Will wait for a key to be pressed if the
keyboard buffer is empty. Usually used in
conjunction with KEYBOARD_POLL
2 KBDSHIFT Returns an integer bit mask that represents the
current keyboard shift status as
follows:
Bit 0 = 1 - Right Shift Key pressed
Bit 1 = 1 - Left Shift Key pressed
Bit 2 = 1 - CTRL Key pressed
Bit 3 = 1 - ALT Key pressed
Bit 4 = 1 - Scroll Lock locked
Bit 5 = 1 - Num Lock locked
Bit 6 = 1 - Caps Lock locked
Bit 7 = 1 - Insert locked
WARNING:
KEYBOARD_INFO and KEYBOARD_POLL will only work effectively if the
following two statements are included in your AUTOPILOT program:
ON ESCAPE OFF
ON KEY OFF
Example:
The following code will check to see if a keystroke is available in the
buffer and, if present, will accept it and verify that it is the Enter
Key, The Escape Key, or a valid capital letter:
include "TT_PCKEY.INC"
.
if KEYBOARD_POLL > 0
begin
set t_key = KEYBOARD_INFO(KBDBIOS)
set t_char = str_chr(t_key)
if t_key <> _ENTER and
t_key <> _ESC and
( t_char < "A" or
( t_char > "Z" ) goto bad_key
end
See Also:
KEYBOARD_POLL
PROMPT KEY
STR_CHAR
┌──────────────────────────────┐
│ C.3.6 KEYBOARD_POLL Function │
└──────────────────────────────┘
Purpose:
To return the current status of the keyboard.
Format:
┌──────────────────────────────────────────────────────────────────────┐
│ KEYBOARD_POLL │
└──────────────────────────────────────────────────────────────────────┘
Remarks:
Returns a zero (0) if there are NO KEYS in the keyboard buffer. Otherwise
it returns the key waiting to be read in BIOS scan code/character code
format. The key IS NOT removed from the buffer.
WARNING:
KEYBOARD_INFO and KEYBOARD_POLL will only work effectively if the
following two statements are included in your AUTOPILOT program:
ON ESCAPE OFF
ON KEY OFF
Example:
The following code will check to see if a keystroke is available in the
buffer and, if present, will accept it and verify that it is the Enter
Key, The Escape Key, or a valid capital letter:
include "TTPCKEY.INC"
.
if KEYBOARD_POLL > 0
begin
set t_key = KEYBOARD_INFO(KBDBIOS)
set t_char = str_chr(t_key)
if t_key <> _ENTER and
t_key <> _ESC and
( t_char < "A" or
( t_char > "Z" ) goto bad_key
end
See Also:
KEYBOARD_INFO
PROMPT KEY
STR_CHAR
┌──────────────────────────────────┐
│ C.3.7 LOCATE PC_CURSOR Statement │
└──────────────────────────────────┘
Purpose:
Used to position the PC Cursor on the text window.
Format:
┌──────────────────────────────────────────────────────────────────────┐
│ LOCATE PC_CURSOR AT <row> <col> │
└──────────────────────────────────────────────────────────────────────┘
Remarks:
This will move the PC Cursor to the position indicated by the AT clause.
┌───────────────────────────┐
│ C.3.8 MOUSE_INFO Function │
└───────────────────────────┘
Purpose:
To return current information on the MOUSE.
Format:
┌──────────────────────────────────────────────────────────────────────┐
│ MOUSE_INFO(<request>) │
└──────────────────────────────────────────────────────────────────────┘
Remarks:
Returns a value depending on the <request>. The INCLUDE File TTMOUSE.INC
has been provided containing global equates to the possible <request>
values.
Below is a table indicating the possible <request> values, the global
equates and their meanings:
Request Global Equate Meaning
─────── ───────────── ──────────────────────────────────────────────────
0 MPRESENT 1 - MOUSE driver is loaded on the PC
0 - MOUSE driver is not loaded
1 MSTATUS Returns the same status as the last MOUSE_POLL
2 MHORZ Returns the current mouse column position
3 MVERT Returns the current mouse row position
4 MHORZ_LP Returns the mouse column position at the last
left button press
5 MVERT_LP Returns the mouse row position at the last left
button press
6 MHORZ_RP Returns the mouse column position at the last
right button press
7 MVERT_RP Returns the mouse row position at the last right
button press
8 MHORZ_LR Returns the mouse column position at the last
left button release
9 MVERT_LR Returns the mouse row position at the last left
button release
10 MHORZ_RR Returns the mouse column position at the last
right button release
11 MVERT_RR Returns the mouse row position at the last right
button release
Examples:
The following example will move the PC Cursor to follow the MOUSE Cursor
from the time the left button is pressed until it is released.
include "TTMOUSE.INC"
.
.
if MOUSE_POLL bitand MLEFT_PRESSED perform L_move:
.
.
.
L_move:
while MOUSE_POLL bitand MLEFT_RELEASED = 0
set t_col = MOUSE_INFO(MHORZ)
set t_row = MOUSE_INFO(MVERT)
locate PC_CURSOR AT t_row , t_col
end_while
return
See Also:
MOUSE_POLL
┌───────────────────────────┐
│ C.3.9 MOUSE_POLL Function │
└───────────────────────────┘
Purpose:
To return the current status of the MOUSE.
Format:
┌──────────────────────────────────────────────────────────────────────┐
│ MOUSE_POLL │
└──────────────────────────────────────────────────────────────────────┘
Remarks:
Returns an integer made up of bit flags. The INCLUDE File TT_MOUSE.INC
has been provided containing global equates to the bit flags for easier
use.
Below is a table indicating the bit settings, the global equates and
their meanings:
Bit Global Equate Meaning
─── ─────────────── ────────────────────────────────────────────────────
0 MLEFT_DOWN 1 - left button is down
0 - left button is up
1 MRIGHT_DOWN 1 - right button is down
0 - right button is up
2 MLEFT_PRESSED 1 - left button has been pressed since the last
MOUSE_POLL
0 - left button has not been pressed
3 MRIGHT_PRESSED 1 - right button has been pressed since the last
MOUSE_POLL
0 - right button has not been pressed
4 MLEFT_RELEASED 1 - left button has been released since the last
MOUSE_POLL
0 - left button has not been released
5 MRIGHT_RELEASED 1 - right button has been released since the last
MOUSE_POLL
0 - right button has not been released
6 MPOS_MOVED 1 - MOUSE cursor has moved since the last
MOUSE_POLL
0 - MOUSE cursor has not moved
Examples:
The following example will move the PC Cursor to follow the MOUSE Cursor
from the time the left button is pressed until it is released.
include "TT_MOUSE.INC"
.
.
if MOUSE_POLL bitand MLEFT_PRESSED perform L_move:
.
.
.
L_move:
while MOUSE_POLL bitand MLEFT_RELEASED = 0
set t_col = MOUSE_INFO(MHORZ)
set t_row = MOUSE_INFO(MVERT)
locate PC_CURSOR AT t_row , t_col
end_while
return
See Also:
MOUSE_INFO
┌─────────────────────┐
│ C.3.10 ON Statement │
└─────────────────────┘
Purpose:
The ON Statement provides event trapping for PC Keys when they are
pressed.
Format:
┌──────────────────────────────────────────────────────────────────────┐
│ ON { ESCAPE } <label> │
│ { KEY <keylist> } │
│ │
│ ON { ESCAPE } RESET │
│ { KEY <keylist> } │
│ │
│ ON { KEY } { ON } │
│ { OFF } │
└──────────────────────────────────────────────────────────────────────┘
Remarks:
When the first format of the ON Statement is executed, trapping for the
specified key is enabled. When the key is pressed, control is transferred
to the <label>. The RESUME Statement may be used to return from the
trapping routine. See the RESUME Statement.
After a key trap is taken, trapping is disabled (like an ON KEY OFF)
until a RESUME Statement or an ON KEY ON is executed. This keeps
recursive trapping from happening unless you want it to.
If a PROMPT Statement has a KEY clause it takes precedence over an ON KEY
trap.
Format 2 may be used to RESET or clear a key trap. If the condition
occurs the default action will take place. The default action for the
ESCAPE key is to cancel the script with an appropriate message. The
default action for the KEY condition is to ignore that the key was
pressed.
Format 3 with the OFF option temporarily turns off trapping. The ON
option turns it back on with the previous traps active.
The ESCAPE condition occurs when execution is interrupted by pressing the
ESCAPE key.
The KEY condition occurs when a key specified in the <keylist> is
pressed. A list of keys sets up the trap. Keys may be added to the list
with subsequent ON KEY <keylist> commands. Keys are trapped in the order
specified. The keyword ALL may be used as a key, and it refers to all the
currently untrapped keys. Key values are actually numbers which
correspond to OS/2's method of identifying keys. To simplify things, a
file has been provided (TT_PCKEY.INC in the SCRIPT directory), that
defines many of these key values. See this file for further information.
Examples:
INCLUDE "TT_PCKEY.INC" /* SETs some key values */
ON _F1, _F2, _F3 func_hit
PROMPT "Enter Option ==>> " opt(8)
.
.
.
func_hit:
DISPLAY "FUNCTION KEY 1, 2, or 3 HIT"
RESUME KEY RETRY
See Also:
PC_KEY
┌──────────────────────────────────┐
│ C.3.11 PC_CURSOR_COLUMN Function │
└──────────────────────────────────┘
Purpose:
Returns the PC cursor column.
Format:
┌──────────────────────────────────────────────────────────────────────┐
│ PC_CURSOR_COLUMN │
└──────────────────────────────────────────────────────────────────────┘
Remarks:
This function returns the column position of the PC cursor as a number in
the range 1 to 80.
See Also:
LOCATE
PC_CURSOR_ROW
RUN SYSTEM
┌───────────────────────────────┐
│ C.3.12 PC_CURSOR_ROW Function │
└───────────────────────────────┘
Purpose:
Returns the PC cursor row.
Format:
┌──────────────────────────────────────────────────────────────────────┐
│ PC_CURSOR_ROW │
└──────────────────────────────────────────────────────────────────────┘
Remarks:
This function returns the row position of the PC cursor as a number in
the range 1 to 25.
See Also:
LOCATE
PC_CURSOR_COLUMN
RUN SYSTEM
┌────────────────────────┐
│ C.3.13 PC_KEY Function │
└────────────────────────┘
Purpose:
This statement returns the last PC key pressed.
Format:
┌──────────────────────────────────────────────────────────────────────┐
│ PC_KEY │
└──────────────────────────────────────────────────────────────────────┘
Remarks:
This function is used to return the last PC key pressed which was trapped
via the ON KEY Statement or was hit during a PROMPT Statement.
See the ON KEY Statement.
Example:
INCLUDE "TTPCKEY.INC"
PROMPT KEY _F1 , _F2 , _F3 , _ENTER
IF PC_KEY = _F1 GOTO select_f1
See Also:
ON KEY
PROMPT KEY
┌───────────────────────────┐
│ C.3.14 PC_SCREEN Function │
└───────────────────────────┘
Purpose:
This statement returns a specified portion of the window.
Format:
┌──────────────────────────────────────────────────────────────────────┐
│ PC_SCREEN[(<s-row>,<s-col>,<e-row>,e-col>>)] │
└──────────────────────────────────────────────────────────────────────┘
Remarks:
The characters on the window are returned as a string identifier. Only
text is returned, the attribute bytes are not.
<s-row>, <s-col>, <e-row>, and <e-col> define an optional rectangular
region of the screen to return.
Example:
set t_text = PC_SCREEN(10,40,15,50)
See Also:
DISPLAY
INSTR
PC_SCREEN_CHARATTR
STR_MID
┌────────────────────────────────────┐
│ C.3.15 PC_SCREEN_CHARATTR Function │
└────────────────────────────────────┘
Purpose:
This statement returns a specified portion of the window including the
attribute bytes.
Format:
┌──────────────────────────────────────────────────────────────────────┐
│ PC_SCREEN_CHARATTR │
│ [(<s-row>,<s-col ,<e-row>,e-col>)] │
└──────────────────────────────────────────────────────────────────────┘
Remarks:
The characters and attribute bytes on the window are returned as a string
identifier.
<s-row>, <s-col>, <e-row>, <e-col> define an optional rectangular region
of the screen to return.
This function is normally used with DISPLAY CHARATTR to save and restore
portions of the window.
Example:
set t_text = PC_SCREEN_CHARATTR(10,40,15,50)
.
.
.
re_disp:
display CHARATTR t_text FROM 10 , 40 TO 15 , 50
See Also:
DISPLAY
INSTR
PC_SCREEN
STR_MID
┌─────────────────────────┐
│ C.3.16 PROMPT Statement │
└─────────────────────────┘
Purpose:
The PROMPT Statement receives input from the keyboard during program
execution.
Format:
┌──────────────────────────────────────────────────────────────────────┐
│ PROMPT [ {NOECHO } ] [ {LEFT } ] │
│ [ {ECHO <string>} ] [ {RIGHT} ] │
│ │
│ [ {UPPER} ] [ {TRUNCATE} ] [ REDISPLAY ] │
│ [ {LOWER} ] [ {PAD } ] │
│ │
│ [ KEY <keylist> ] [ MOUSE_EVENT <event> ] │
│ │
│ [ MAXWAIT <timeval> ] [ AUTOSKIP ] │
│ │
│ [ [<display-string>] <identifier>[(<number>] ] │
│ [AT <row> <col>] │
└──────────────────────────────────────────────────────────────────────┘
Remarks:
The optional NOECHO keyword suppresses echoing of keystrokes on the
window. The ECHO <string> option allows you to specify a single character
to be echoed as each key is pressed.
The optional <display-string> operand simulates a DISPLAY function.
The <identifier> is the name of the variable which will receive the
input. If there is a value associated with <identifier>, it is
displayed. Its value may be changed by typing over it.
The (<number>) operand limits the character size of the input. If it is
not specified, the size of input is determined by the length of the
string represented by <identifier>. If <identifier> has no value
associated with it, the size of the input is limited by what will fit on
the line. In all cases, the size of the input will be truncated to insure
that the entry field fits on the line.
The LEFT and RIGHT options provide control over the justification of the
data being entered. For example: PROMPT NOECHO LEFT USERID(8), indicates
that the data which is being entered into the 8 character variable userid
should be left justified upon completion of the PROMPT Statement.
The UPPER and LOWER provides automatic case conversion on the entered
data.
The TRUNCATE and PAD options provide better control over the size of
string variables. For example: PROMPT TRUNCATE userid(8), will return a
string whose length is equal to the actual number of characters which
were entered.
The REDISPLAY option instructs PROMPT to redisplay the entered data after
ENTER (or any keylist KEY) is pressed. This option is used to display the
changes the PROMPT Statement may have made on the entered data (i.e.
UPPER, LOWER, LEFT, RIGHT, TRUNCATE, etc.)
The KEY option allows a list of acceptable keys to be specified in the
same manner as the ON KEY Statement. If one of these keys are pressed,
the PROMPT Statement ends and the PC_KEY value is updated. For example:
PROMPT KEY _F1, _F2, _F3, MENU_OPTION(1)
will accept F1, F2, and F3 as valid keys assuming the identifiers _F1 ,
_F2, and _F3 were set to valid key values (see the TTPCKEY.INC file and
the ON KEY Statement.).
The MOUSE_EVENT option allows you to list a set of MOUSE events that
might occur which you wish to capture. The value of <event> is the same
as the value returned by the MOUSE_POLL function (see MOUSE_POLL for more
information on testing for MOUSE events).
The MAXWAIT option allows you to limit the amount of time that you will
be delayed at a PROMPT Statement. <timeval> can be specified in the same
manner as on the WAIT FOR Statement. When the amount of time has passed,
an appropriate RETURN_CODE is set. If a <timeval> of 0 is specified, the
PROMPT will wait indefinitely.
The AUTOSKIP option will force the PROMPT Statement to terminate when
either the field is filled with characters (return_code = 4) or the left
arrow key moves left of the first character of the field (return_code =
5). This information can be used to simulate the AUTOSKIP facility
available on 3270 type terminals.
It is also acceptable to use the PROMPT keyword alone as in:
PROMPT
This will cause the PROMPT Statement to wait for ANY keystroke. When any
key is pressed, the PROMPT Statement ends and the PC_KEY value is updated.
The optional AT clause is treated in the same manner as in the DISPLAY
Statement.
The PROMPT command may be terminated by pressing the ENTER or ESCAPE
keys. If the ESCAPE key is pressed, the ESCAPE condition will be
triggered and the ON ESCAPE Statement (if any) will be executed (see the
ON command).
The PROMPT Statement sets the following RETURN_CODE values:
0
- The PROMPT terminated normally (either Enter or Escape were pressed).
1
- A key from the <keylist> was specified.
2
- An event indicated on the MOUSE_EVENT clause occurred.
3
- The <timeval> on the MAXWAIT clause was exceeded.
4
- The AUTOSKIP clause was specified and the last character in the
field was filled.
5
- The AUTOSKIP clause was specified and the left arrow key was moved
to the left of the first character of the field.
Examples:
Example 1:
PROMPT NOECHO "Enter Password " password (8)
Example 2:
INCLUDE "TTPCKEY.INC"
DISPLAY "Press Function Key To Select Option"
PROMPT KEY _F1, _F2, _F3
IF PC_KEY = _F1 GOTO opt_1
IF PC_KEY = _F2 GOTO opt_2
IF PC_KEY = _F3 GOTO opt_3
Example 3:
INCLUDE "TTMOUSE.INC"
PROMPT MOUSE_EVENT MLEFT_PRESSED bitand MRIGHT_PRESSED
if return_code = 2
begin
set t_status = MOUSE_INFO(MSTATUS)
if t_status bitand MLEFT_PRESSED goto l_left
if t_status bitand MRIGHT_PRESSED goto l_right
end
See Also:
DISPLAY
KEYBOARD_INFO
KEYBOARD_POLL
MOUSE_INFO
MOUSE_POLL
PC_KEY
┌─────────────────────────┐
│ C.3.17 RESUME Statement │
└─────────────────────────┘
Purpose:
The RESUME Statement continues program execution after an ON KEY
condition.
Format:
┌──────────────────────────────────────────────────────────────────────┐
│ RESUME { ESCAPE } { RETRY } │
│ { KEY } { NEXT } │
│ { <Label> } │
└──────────────────────────────────────────────────────────────────────┘
Remarks:
RESUME <condition> RETRY causes execution to resume at the statement
which caused the condition to occur. RESUME <condition> NEXT causes
execution to resume at the statement immediately following the one which
caused the condition to occur. RESUME <condition> <label> causes
execution to resume at the specified label.
For more information on RESUME and how it relates to ACTION BARS on text
windows, refer to the RESUME Statement in the Chapter, AUTOPILOT
Statement Reference.
Examples:
RESUME KEY RETRY
See Also:
ON
┌──────────────────────┐
│ C.3.18 SET Statement │
└──────────────────────┘
Purpose:
Assigns default color and message line on text windows.
Formats:
┌──────────────────────────────────────────────────────────────────────┐
│ SET MSGLINE = <row> │
│ │
│ SET DEFAULT_COLOR <fgnd [,] <bkgnd> │
│ │
│ SET FONT [ FACENAME = <face> ] │
│ [ SIZE=<size> ] │
│ [ CODEPAGE=<cp> ] │
│ [ BOLD ] │
│ [ ITALICS ] │
│ [ UNDERLINE ] │
│ [ STRIKE OUT ] │
└──────────────────────────────────────────────────────────────────────┘
Remarks:
MSGLINE is the global row value keyword identifier used in all DISPLAY
and PROMPT activity unless overridden by the individual statement being
executed. <row> must be a number from 1 to 25. MSGLINE = 0 is the default
if the window was defined using CREATE TEXT_WINDOW, but MSGLINE = 25 is
the default for the PC/DOS compatibility window provided if no CREATE
TEXT_WINDOW is issued.
DEFAULT_COLOR is used to modify default color used on text windows create
utilizing the CREATE TEXT_WINDOW Statement.
See the discussion on the FONT Clause under the CREATE TEXT_WINDOW
Statement for more information on SET FONT.