@ Function
Generates control characters to either set the cursor to a specified position on the terminal screen or specify a video effect.
Syntax
@(column {,row })
@(code)
Syntax Elements
column The required column position; an integer greater than or equal to 0. If greater than the current maximum (set by the most recent execution of the TERM command), the cursor is placed in the right-most column.
row The required line number; an integer greater than or equal to 0. If greater than the current maximum (set by the most recent execution of the TERM command), the cursor is placed on the last row. The default, if omitted, is the current line.
code An extended cursor addressing code or a video effects code.
Note
All extended cursor addressing and video effects codes are negative integers.
Comments
The @ function, used with the PRINT and CRT statements, sets the cursor to a specified position on the terminal. The @ function can also be used to generate video effects on specified characters. These effects include bolding, dimming, underlining, blanking, flashing and reverse video (see video effects codes).
Operation
Screen column and rows are numbered starting at 0. The maximum column number is therefore width - 1 and the maximum row number height - 1.
The @ function cannot be used to format spooled printer output.
The @ function can appear anywhere that a legal expression is allowed, including assignment statements. For example:
@DIALOG = START = @(10,1) . . PRINT START:"text..."
Extended Cursor Addressing
To provide a consistent way of emitting terminal-independent character strings (such as clear to EOL), DataBasic supports an extended cursor addressing process. The @ function allows a single, negative parameter that returns the correct cursor control string for the terminal defined by TERMTYPE. The returned string is based on the following parameters:
Code |
Operation |
---|---|
-1 |
Clear screen sequence including the number of pad characters specified in the FF delay field of the TERM settings. |
-2 |
Cursor-home sequence. |
-3 |
Clear-to-end-of-screen sequence. |
-4 |
Clear-to-end-of-line sequence. |
-5 |
Start flashing (see Note 2). |
-6 |
Stop flashing (see Note 2). |
-7 |
Start protect. |
-8 |
Stop protect. |
-9 |
Cursor-back sequence. |
-10 |
Cursor-up sequence. |
-11 |
Cursor on. |
-12 |
Cursor off. |
-13 |
Display the text that follows on the terminal's status line (usually line 25). |
-14 |
Stop displaying text on the status line. |
-15 |
Cursor forward. |
-16 |
Cursor down. |
-17 |
Enable slave port. |
-18 |
Disable slave port. |
-19 |
Screen dump. |
-22 |
Start dimmed (see Note 2). |
-23 |
Stop dimmed (see Note 2). |
-24 |
Start underline (see Note 2). |
-25 |
Stop underline (see Note 2). |
-26 |
Start bold (see Note 2). |
-27 |
Stop bold (see Note 2). |
-28 |
Start blank. |
-29 |
Stop blank. |
-34 |
Start reversed (see Note 2). |
-35 |
Stop reversed (see Note 2). |
-60 |
White background colour. |
-61 |
Brown background colour. |
-62 |
Magenta background colour. |
-63 |
Red background colour. |
-64 |
Cyan background colour. |
-65 |
Green background colour. |
-66 |
Blue background colour. |
-67 |
Black background colour. |
-68 |
White foreground colour (full intensity). |
-69 |
Brown foreground colour (full intensity). |
-70 |
Magenta foreground colour (full intensity). |
-71 |
Red foreground colour (full intensity). |
-72 |
Cyan foreground colour (full intensity). |
-73 |
Green foreground colour (full intensity). |
-74 |
Blue foreground colour (full intensity). |
-75 |
Black foreground colour (full intensity). |
-84 |
White foreground colour (low intensity). |
-85 |
Brown foreground colour (low intensity). |
-86 |
Magenta foreground colour (low intensity). |
-87 |
Red foreground colour (low intensity). |
-88 |
Cyan foreground colour (low intensity). |
-89 |
Green foreground colour (low intensity). |
-90 |
Blue foreground colour (low intensity). |
-91 |
Black foreground colour (low intensity). |
Note
-
The effects of these codes can be changed with the @ compatibility option.
-
The codes to start and stop video effects (flashing, dimmed, underline, bold and reversed) normally switch on or off the effect concerned and switch off all the others. This behaviour can be changed with the CURSOR.ATTRIBUTES environment option.
Different terminal types are specified via the TERM or SSM command (refer to Terminal Types).
Video Effects
The table below lists the video effects that can be achieved using the @ function. These codes send an eight-bit character to the terminal.
The video effects can also be achieved by using the code (without the minus sign) as the value in a CHAR() function. PRINT CHAR(130) is the same as PRINT @(-130). The same is not true for extended cursor addressing codes.
All of the video effects shown in the table may not work with all terminals. For example, one terminal may not provide for Dimmed and Blanked Video while another will not provide for Bold Video. Consult the appropriate terminal documentation for complete information.
MultiValue Compatibility
Refer to @ Function (MultiValue compatibility).
Example 1
This example clears the screen and prints the heading "MAIN MENU" at the top of screen starting at the 35th column.
HEAD = @(35,0):"MAIN MENU":@(35,1) PRINT @(-1),HEAD
Example 2
This example clears the screen and prints a bold and flashing "MAIN MENU" at the top of the screen:
HEAD = "MAIN MENU" PRINT @(-1):@(-162),HEAD:@(-128)