• No results found

Programming Notes

In document dBase IV Language Reference (Page 72-78)

Symbols 9, A, and X may be used with SAYs and GETs. Symbols 9, A, and X prevent undefined characters from being input, but not from being displayed.

If you use a PICTURE template to GET a decimal number, you must include the decimal point in the template. The template must also leave room for at least one digit to the left of the decimal point, and leave room for the sign, if you want to use the minus sign.

Programming Notes

If you want to use a multi-page format file in which the

continue on from 2 to 32 pages, include a READ wherever you want a page break. The PgDn and PgUp keys flip the pages. Multi-page format files work only when the file is opened with SET FORMAT.

Tip

To design a custom form, use CREATE/MODIFY SCREEN to create a format file that consists of @ commands.

Activate the format file with SET FORMAT TO filename You can append new records or revise existing ones from an file using any of the full-screen editing commands such as EDIT and APPEND.

Examples

To display the information in the first record of the Client database

§ SAY

As you enter each command, the resulting expression is displayed on your screen. For a more readable display, specify the spaces in quotes as part of the expression, as shown above. The results displayed on your screen should be the following:

To provide a list of choices that a user may select in a program file, use the

@M PICTURE function. To select a day of the week:

2-16 COMMANDS

SET STATUS ON STATUS be on f o r t h e MESSAGE.

12,20 SAY t h e day of the week GET Day of PICTURE

MESSAGE SPACE to and RETURN to

In this example, is initially displayed in the input field. As soon as the cursor moves into the field, however, the display changes to which is the first item in the list. is never displayed again since it is not in the list.

Use the VALID clause along with a user-defined function to insure the integ-rity of input. Continuing with the previous example, enter an amount into a variable called Mrate. Mrate must equal 2, or 3 for a weekday, Saturday, or Sunday, respectively.

14.20 SAY r a t e is GET Mrate PICTURE

ERROR 1, Saturday 2, Sunday

CASE wk Mrate 1

CASE wk Mrate 2

CASE Mrate 3

In the above example, the VALID condition calls the user-defined function Rcheck(). If the validity of the input is correct, Rcheck() returns true If RcheckO is false the error message Weekday Saturday 2, Sunday 3 appears and the user is not allowed to exit the field until the error is corrected.

See Also

ACTIVATE WINDOW, APPEND, CHANGE, CREATE/MODIFY SCREEN, EDIT, INSERT, MODIFY COMMAND, READ,

SET COLOR, SET CONFIRM, SET CURRENCY, SET DELIMITERS, SET DEVICE, SET FIELDS, SET FORMAT, SET INTENSITY, SET POINT, SET SEPARATOR, SET WINDOW OF MEMO, TRANSFORM()

LANGUAGE REFERENCE

I

CLEAR

clears a portion of the screen or of the active window.

Syntax

@ CLEAR [TO

Usage

are the coordinates of the upper left corner of the area that you want to clear, and row2 col2 are the coordinates of the lower right corner.

This command erases the area of the screen starting at rowl up to and including row2 col2 If you omit the CLEAR TO

row2 col2 phrase, the line beginning with rowl

is cleared to the end of the line. If you omit TO row2 col2 only, but specify the CLEAR keyword, the screen or active window is cleared from

rowl to the bottom right corner.

To clear the area of the screen from coordinates 2,9 to 14,39:

TO

See Also

CLEAR

2-18 COMMANDS

...FILL

allows you to change the colors of a specific rectangular region on your screen or active window.

Syntax

@ r o w l coll FILL TO row2 col2 [COLOR color attribute

Usage

This command changes the color of the text in the defined region.

coll are the coordinates of the upper left corner of the region, and row2 col2 are the coordinates of the lower right corner.

In place of color attribute you must provide color codes for the region.

These are the same codes used by SET COLOR.

You may change the standard foreground and background colors in the area only. This command affects the display already on the screen. Subsequent commands that write to this area will use the default screen colors, not the colors set with

If you omit the COLOR option, clears the rectangular region of the screen and is equivalent to

If you specify coordinates larger than your screen, the Coordinates are the screen message appears.

Example

To paint the screen from coordinates to 20,70 in red on black and see the text in that region change color, first issue a LIST MEMORY command to fill the screen with text:

FILL TO JO COLOR R/N

See Also

SET COLOR

I

LANGUAGE REFERENCE

TO

draws a box on the screen or active window with single lines, double lines, or specified characters.

Syntax

@ r o w l coll TO row2 col2 border definition string [COLOR color attribute

Defaults

The default border is a single line, unless it has been changed by the SET BORDER command.

The default color is the NORMAL color, which can also be changed by speci-fying the NORMAL keyword of the SET COLOR command.

Usage

are the coordinates of the upper left corner of the box, and row2 col2 are the coordinates of the lower right corner.

If the row coordinates are the same, a horizontal line is drawn. If the col-umn coordinates are the same, a vertical line is drawn.

Defining a border with the command options overrides the SET BORDER default setting.

Options

DOUBLE draws a double-line box rather than the default single-line one.

PANEL displays a solid highlighted border. The entire rectangular border is in inverse video.

border definition string is a list of character strings (or numbers) used to define a border. The character strings must be delimited, must be sepa-rated by commas, and must appear in the following order:

t,b,l,r,tl,tr,bl,br

COMMANDS

@...T0

The letters stand for the following attributes:

t - top - top left corner b bottom tr - top right corner 1 - left - bottom left corner r - right br - bottom right corner

If you specify only the first attribute the remaining attributes default to the same value.

You omit an attribute by using a comma in its place if it comes at the begin-ning of the list, or by simply omitting it if it comes at the end. Omitting an attribute leaves it unchanged from its previous setting.

If you use numbers instead of character strings, use the decimal value of the character in the IBM Extended Character Set. Note that the ASCII code val-ues (decimal 0 through 127) are a subset of this set (decimal 0 through 255).

You may also enter numbers as the argument of the function. The numbers should not be delimited.

COLOR — In place of color attribute you must provide color codes for either foreground, background, or both. These are the same codes used by SET COLOR. If you used the PANEL option, the window will be drawn in the foreground color only. If you do not provide color codes, this command uses the NORMAL colors of the SET COLOR command.

Programming Notes

You can use the command from the dot prompt or in a command or format file.

In order to not overwrite the box with a field that is wider than the window, use the S n function of the @ command to limit the size of the input area on the screen. The S n function allows horizontal scrolling within the input area.

Example

To draw a double line box from screen coordinates to with color attributes of black on cyan:

1,10 TO 15,40 DOUBLE COLOR N/B6

See Also

@...FILL, CHR(), SET BORDER, SET COLOR

LANGUAGE REFERENCE 2-21

I

ACCEPT

ACCEPT is used primarily in command files to prompt a user for keyboard entry. It creates a character memory variable in which it stores the keyboard entry. Terminate data entry with

Syntax

ACCEPT prompt TO memvar

Usage

The prompt may be a character type memory variable, a character string, or any valid character expression. If it is a character string, it must be delimited by single quotes double quotes or square brackets

The keyboard entry does not require delimiters: ACCEPT treats all user input as character-type data.

If is entered in response to the ACCEPT command, the content of the memory variable is null (without any contents, or ASCII 0).

A maximum of 254 characters can be entered into a variable with ACCEPT.

In document dBase IV Language Reference (Page 72-78)