CURSOR [ HP Business BASIC/XL Reference Manual ] MPE/iX 5.0 Documentation
HP Business BASIC/XL Reference Manual
CURSOR
The CURSOR statement is used to position the cursor and to set display
enhancements. The actions specified in the cursor-item list are carried
out left to right. Any error in a list of actions causes execution to
terminate. There are three pointers that JOINFORM maintains. These are
the input, output, and cursor pointers. Setting the input pointer also
sets the cursor pointer. Setting the cursor pointer does not change the
input or output pointers. Reading a variable from a JOINFORM with the
INPUT or ENTER statement advances the input pointer. The order of the
input and output fields is defined when the form is created with the
JOINEDIT program. The IFLD, OFLD, CFLD, SETIFLD, SETOFLD, and SETCFLD
functions are allowed only while a JOINFORM is active.
Syntax
CURSOR cursor_item_list
Parameters
cursor_item_ A list containing one or more unique selections from the
list following options, separated by commas or semicolons.
[{,} ] {,} {,}
Row[{;} Col] {;} Col (Enhance_string {;} num_chars)
{IFLD }
{OFLD }
{CFLD }
{SETIFLD} (field)
{SETOFLD}
{SETCFLD}
Row Specifies the row display memory coordinate. This
coordinate must be a numeric expression, variable, or
constant.
Col Specifies the column display memory coordinate. This
coordinate must be a numeric expression, variable, or
constant.
enhance_string A quoted string of characters, or a string variable
specifying the display enhancement:
* h or H: Half-Bright
* i or I: Inverse
* b or B: Blinking
* u or U: Underline
num_chars A numeric expression, variable, or constant that
specifies the length of the display enhancement.
IFLD This function moves the cursor to the field output field
in a JOINFORM. The current input field number is set to
field.
OFLD This function moves the cursor to the field output field
in a JOINFORM. The current output field number is set to
field.
CFLD This function moves the cursor to the field input field
in a JOINFORM. The current input and output field
numbers are not modified when this function is executed.
A subsequent INPUT statement will position the cursor to
this field, but will read data beginning at the field
specified input pointer.
SETIFLD This function sets the current input field number to
field. The cursor is not moved.
SETOFLD This function sets the current output field number to
field. The cursor is not moved.
SETCFLD This function sets the current cursor field number to
field. The cursor is not moved. The current input and
output field numbers are not modified. A subsequent
INPUT statement will position the cursor to field, but
will read data beginning at the input pointer.
field A numeric expression, variable or constant that
evaluates to a numeric value that specifies the number
of a field on the JOINFORM.
Cursor Position on the Terminal Screen
For the purpose of CURSOR positioning, the first row in display memory is
row 1. The leftmost column in display memory is column 1. When
specifying the cursor position with the CURSOR statement in conjunction
with the row and column, at least one of row and column must be
specified. An error occurs when the value for a row or column is greater
than 999. If a row number greater than the number of lines in the
display memory is specified the cursor is positioned to the last row. If
a column number greater than 80 is specified one line is skipped.
Regardless of where the cursor is in display memory, it always remains
visible on the display screen. Therefore, the CURSOR statement can be
used to scroll or page through display memory.
The functions SETIFLD, SETOFLD, and SETCFLD set the internal field
pointer, but do not move the cursor. A subsequent INPUT or OUTPUT
statement positions the cursor to the current cursor field or output
field. This is more efficient than using IFLD, OFLD, or CFLD, because
those functions set the internal field pointer and position the cursor.
The cursor would then have been moved twice.
Screen Enhancements
A screen enhancement is set beginning at the current position of the
cursor for a length that is determined by num_chars. Legal enhancement
strings contain the characters h or H for "Half-bright", i or I for
"Inverse", b or B for "Blinking" or u or U for "Underline". The empty
string (" ") indicates that enhancements are to be turned off. The
enhancement string may contain any of the characters above and use a
blank (" "), comma (","), or semicolon (";") as a separator between
characters for visual clarity.
An enhancement string that contains only blanks, commas, or semicolons is
treated as an empty string that turns off enhancements. The legal values
for num_chars are -999..999. Depending on the value of num_char, one of
the following will occur:
* num_chars evaluates to a positive value; num_chars characters are set
to the specified enhancement one character at a time. Each of the
individual characters is prefixed with the appropriate escape
sequence required for the enhancement. The escape sequence prefixing
the character following the last character to be enhanced contains
the enhancement terminator.
* num_chars evaluates to zero; the escape characters that turn on the
specified enhancement prefix the characters at the current cursor
position. The enhancement is terminated as follows. If there is an
enhancement on the line at a point following the current cursor
position then that enhancement terminates the specified enhancement.
Otherwise, the specified enhancement extends only to (and including)
the last non-blank character on the line.
* num_chars evaluates to a negative value; the character at the current
cursor position is prefixed with the escape sequence for the
specified enhancement. The character at the position in screen
memory that is num_chars to the right of the current cursor position
is followed by the enhancement terminator.
The enhancement terminator causes the next character to not have
enhancements. This may cause strange results when putting an
enhancement on a line with existing enhancements. Enhancements that
go past the end of the line may also cause some strange results.
Thus, characters between the current cursor position and the
enhancement terminator are not individually enhanced.
For example, 'CURSOR (,1),("HI",50)' performs exactly the same
function as 'CURSOR (,1),("HI",-50)' if, in the latter case, the
current line contains no enhancement terminators. Execution of the
second statement is faster.
The use of positive and non-positive enhancement lengths intermixed on a
single screen produces unpredictable results. Therefore, we do not
recommend this.
Examples
10 DISP '27"H"'27"J";
20 OPEN FORM "main:jfmain" !Simple form with five 18 character fields
30 FOR I = 1 TO 5 !Start output to each field
40 PRINT RPT$(VAL$(I),3) !Set fld1 to 111, fld2 to 222, etc
50 NEXT I
60 CURSOR IFLD(4) !Positions the cursor to the fourth field
70 INPUT A$ !a carriage return here will read 444
71 !into A$ and increment IFLD(x) to the fifth field
80 CURSOR CFLD(1) !Positions the cursor to the first field
81 !on the form
90 INPUT B$ !A carriage return here will read 555
91 !into B$, not the 111 from the first field
92 !The first field is where the cursor is
93 !located when the carriage return was pressed
95 CURSOR SETIFD(2),SETCFLD(2) !Sets the cursor and input pointers
96 !to the second field, but does not move
97 !the cursor
98 INPUT C$ !The cursor is now moved to the cursor
!field specified in line 95 and reads
99 !the contents of the current input
100 !field into C$
101 CURSOR SETIFLD(5) !Sets the input field to field 5
102 ENTER D$ !Reads the contents of input field
103 ! 5 into D$
105 CLOSE FORM;REMAIN
110 PRINT A$,LIN(1),B$ !A$=444, B$=555
999 END
MPE/iX 5.0 Documentation