Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
@ .. GET, READ
Message
From
03/09/2008 04:03:03
Metin Emre
Ozcom Bilgisayar Ltd.
Istanbul, Turkey
 
 
To
02/09/2008 12:51:31
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Vista
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01344205
Message ID:
01344402
Views:
32
>I am sure this has been answered before, but I have long ago lost my old command documentation. I need to fix a problem in some legacy code and need to know the complete systax for the @ ... GET command including formats and mask protocols. Specifically, i need the existing value (default) to be selected when the get is entered.
>
>Thanks in advance.
>
>Fred

That's get command's documentation. You can use the way that Dragan said.

@
GET |
[FUNCTION ]
[PICTURE ]
[FONT [, ]]
[STYLE ]
[DEFAULT ]
[ENABLE | DISABLE]
[MESSAGE ]
[[OPEN] WINDOW ]
[RANGE [] [, ]]
[SIZE , ]
[VALID |
[ERROR ]]
[WHEN ]
[COLOR SCHEME
| COLOR ]

Creates an editing-region.

OPEN WINDOW is included for backward compatibility. Use @ ... EDIT instead.

Use this command to create an editing-region for the contents of a memory variable, array element or field. Use READ or READ CYCLE to activate @ ... GET editing-regions.

You can combine @ ... SAY and @ ... GET into a single command. If both the SAY and GET clauses are included, specify a single set of coordinates where the @ ... SAY output begins. A space is automatically inserted between the @ ... SAY output and the @ ... GET editing-region.

If you use the Screen Builder to create your data-entry screens, you may not have to use @ ... GET or @ ... SAY at all. The Screen Builder automatically generates the @ ... GETs or @ ... SAYs.


Row and column are numeric expressions with values 0 or greater that determine where the @ ... GET editing-region appears.

The first row is number 0 in the main FoxPro window or a user-defined window. Rows are numbered from top to bottom. In FoxPro for Windows, row 0 is the row immediately under the FoxPro system menu bar. In FoxPro for Macintosh, row 0 is the row immediately under the FoxPro title bar. In FoxPro for MS-DOS, row 0 is the row the FoxPro system menu bar occupies. See SET SYSMENU for information about manipulating the system menu bar so you can place output on row 0 in FoxPro for MS-DOS.

The first column is number 0 in the main FoxPro window or a user-defined window. Columns are numbered from left to right.

When the @ ... GET editing-region is directed to a user-defined window, the row and column coordinates are relative to the user-defined window, not the main FoxPro window.

In FoxPro for Windows and FoxPro for Macintosh, a position in the main FoxPro window or in a user-defined window is determined by the font of the main FoxPro window or the user-defined window. Most fonts can be displayed in a wide variety of sizes, and some are proportionally spaced. A row corresponds to the height of the current font; a column corresponds to the average width of a letter in the current font.

In FoxPro for Windows and FoxPro for Macintosh, you can position the @ ... GET editing-region in a window with decimal fractions for row and column coordinates. In FoxPro for MS-DOS, decimal fractions used for row and column coordinates are rounded to the nearest integer value.

|
@ ... GET creates an editing-region for the memory variable or array element specified in or the field specified in .

@ ... GET can be used to create an editing-region for a memo field. When you use @ ... GET with a memo field, the word Memo is displayed. When READ is issued and the memo field is selected, place the cursor on the word Memo and press Ctrl+Home, Ctrl+PgUp or Ctrl+PgDn to open the memo editing window. You can also double-click Memo to open the editing window.

To exit the memo editing window and save your editing changes in FoxPro for MS-DOS, click the window's close box or press Ctrl+W. Press Esc to discard your changes.

To exit the memo editing window and save your changes in FoxPro for Windows and FoxPro for Macintosh, choose Close from the window's Control menu or press Ctrl+W. Press Esc to discard your changes.

ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
Tip - A better method for editing memo fields is using @ ... EDIT instead of @ ... GET. @ ... EDIT creates a text-editing window with a scroll bar, and the contents of the memo field are displayed when @ ... EDIT is issued.
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

FUNCTION | PICTURE
When creating a text-editing region with @ ... GET, you can include the FUNCTION clause, the PICTURE clause or both to create an editing mask. These clauses contain special codes that control how the memory variable, array element or field is displayed and edited.

FUNCTION codes can be included in a PICTURE clause. In this case, the PICTURE clause must start with @. Also, a PICTURE clause can contain FUNCTION codes, PICTURE codes or both. Since a FUNCTION clause affects the entire expression, it can contain only FUNCTION codes.

Function Codes
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

Code Purpose
ÄÄÄÄ ÄÄÄÄÄÄÄ
A Allows alphabetic characters only (no spaces or symbols).

B Left-justifies numeric data within the output field.

D Uses the current SET DATE format.

E Edits date type data as a BRITISH date.

I Centers text within a field.

J Right-justifies text within a field.

K Selects an entire field for editing when the cursor is moved to the field.

L Displays leading zeros (instead of spaces) in numeric output. Use with numeric data only.

M
Creates multiple preset choices. The list is a comma-delimited collection of items. Individual items within the list cannot contain embedded commas. If or initially do not contain one of the items in the list when READ is issued, the first item in the list is displayed.

To scroll through the list, press the Spacebar or type the first letter of an item. To choose one of the items and move to the next control, press Enter. Use only with character data.

R Displays a format mask in an @ ... GET editing region. These mask characters are not stored to the field when you exit the @ ... GET editing region. Use only with character or numeric data.

S Limits the display width to n characters. You can scroll within the region with the cursor control keys. Use only with character data.

T Trims leading and trailing blanks from or .

Z Displays or as blank if its numeric value is 0. Use with numeric data only.

! Converts alphabetic characters to upper-case. Use with character data only.

, Displays numeric data using scientific notation. Use with numeric data only.

$ Displays data in a currency format. The currency symbol appears before or after the value depending on the current setting of SET CURRENCY. If CURRENCY is SET LEFT, the $ function code cannot be used. Use with numeric data only.

A PICTURE expression can include any characters, but only the characters listed below actively participate in display and editing.

Picture Codes
ÄÄÄÄÄÄÄÄÄÄÄÄÄ

Code Purpose
ÄÄÄÄ ÄÄÄÄÄÄÄ
A Allows alphabetic characters only.

L Allows logical data only.

N Allows letters and digits only.

X Allows any character.

Y Allows logical Y, y, N and n only. Converts y and n to Y and N, respectively.

9 Allows only digits in character data. Allows digits and signs in numeric data.

# Allows digits, blanks and signs.

! Converts lower-case letters to upper-case letters.

$ Displays the current currency symbol specified by SET CURRENCY. By default, the symbol is placed immediately before or after the field. However, the currency symbol and its placement (SET CURRENCY), the separator character (SET SEPARATOR) and the decimal character (SET POINT) can all be changed. Can only be used in @ ... GET when SET CURRENCY is LEFT.

* Asterisks are displayed in front of a numeric value. Use with a dollar sign $ for check protection.

. Specifies the decimal point position.

, Use to separate digits to the left of the decimal point.

FONT [, ]
The character expression is the name of the font and the numeric expression is the font size.

For example, this short program example displays the CONTACT field for editing. In FoxPro for Windows and FoxPro for Macintosh, the text in the editing-region is displayed in 16-point Courier font:

CLOSE DATABASES
USE customer
DO CASE
CASE _WINDOWS OR _MAC
@ 2, 2 GET contact FONT 'Courier',16
CASE _DOS
@ 2, 2 GET contact
ENDCASE
READ

If you include the FONT clause but omit the font size , a 10-point font is used.

In FoxPro for Windows, if the font you specify is not available, a font with similar font characteristics is substituted.

In FoxPro for Macintosh, if the font you specify is not available, the Chicago font is used.

In FoxPro for MS-DOS, the FONT clause is ignored.

If the FONT clause is omitted and the editing-region is placed in the main FoxPro window, the main FoxPro window font is used. If the FONT clause is omitted and the editing-region is placed in a user-defined window, the user-defined window font is used.

STYLE
In FoxPro for Windows and FoxPro for Macintosh, include the STYLE clause to specify a font style for an @ ... GET editing-region.

The font style is specified with . If the STYLE clause is omitted, the normal font style is used.

In FoxPro for Windows, if the font style you specify is not available, a font style with similar characteristics is substituted.

In FoxPro for Macintosh, if the font you specify is not available, the normal font style is used.

The STYLE clause is ignored in FoxPro for MS-DOS.

Character Font Style
ÄÄÄÄÄÄÄÄÄ ÄÄÄÄÄÄÄÄÄÄ

B Bold

C Condense*

E Extend*

I Italic

N Normal

O Outline

Q Opaque

S Shadow

- Strikeout*

T Transparent

U Underline

* The Condense and Extend styles are only available in FoxPro for Macintosh. The Strikeout style is only available in FoxPro for Windows.


If you include T to create a transparent editing-region, the background color is ignored by the region.

You can include more than one character to specify a combination of font styles. For example, the following short program creates an @ ... GET text-editing-region. The CONTACT field appears in the editing-region in Bold Italic in FoxPro for Windows and FoxPro for Macintosh.

CLOSE DATABASES
CLEAR
USE customer

DO CASE
CASE _WINDOWS OR _MAC
@ 2, 2 GET contact STYLE 'BI'
CASE _DOS
@ 2, 2 GET contact
ENDCASE

READ

DEFAULT
If you specify a memory variable for the @ ... GET editing-region that doesn't exist, it is automatically created and initialized if you include DEFAULT. However, an array element isn't created if you specify an array element in a DEFAULT clause. The DEFAULT clause is ignored if the memory variable already exists or you specify a field.

ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
Note - If the DEFAULT clause isn't included and the memory variable doesn't exist, the error message "Variable not found" appears.
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

The DEFAULT expression determines the type of memory variable created and its initial value.

ENABLE | DISABLE
Including DISABLE prevents access to an @ ... GET editing-region. The editing-region is displayed in the disabled colors and cannot be selected.

By default, @ ... GET editing-regions are enabled. You can include ENABLE as a reminder in a program that a GET editing-region can be accessed.

ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
Note - If all the GETs in user-defined window are disabled, the window won't remain on top. If all the GETs in the current READ are disabled, the READ is terminated.
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

MESSAGE
The MESSAGE clause character expression appears when the @ ... GET editing-region is selected. In FoxPro for MS-DOS, the message is centered on the last line of the main FoxPro window and temporarily cancels any SET MESSAGE expression.

In FoxPro for Windows and FoxPro for Macintosh, the message is placed in the Windows-style status bar. If the Windows-style status bar has been turned off with SET STATUS BAR OFF, the message is placed on the last line of the main FoxPro window.

[OPEN] WINDOW
Include the WINDOW clause to edit a memo field in a user-defined window. The user-defined window must first be created with DEFINE WINDOW. The word Memo is displayed when you issue @ ...GET WINDOW.

To open the memo-editing window, double-click Memo or place the cursor on the word Memo and press Ctrl+Home, Ctrl+PgUp or Ctrl+PgDn.

If OPEN is included, the memo-editing window is automatically opened when READ or READ CYCLE is issued.

To exit the window and save your editing changes in FoxPro for MS-DOS, click the window's close box (if available) or press Ctrl+W. Press Esc to discard your changes.

To exit the window and save your editing changes in FoxPro for Windows, choose Close from the window's Control menu (if available) or press Ctrl+W. Press Esc to discard your changes.

To exit the window and save your editing changes in FoxPro for Macintosh, click the close box or press Ctrl+W. Press Esc to discard your changes.

ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
Tip - A better method for editing memo fields is using @ ... EDIT instead of @ ... GET. @ ... EDIT creates a text-editing window with a scroll bar, and the contents of the memo field are displayed when @ ... EDIT is issued.
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

RANGE [] [, ]
Use the RANGE clause with character, date and numeric data to specify a range of acceptable values. If the value you enter in the @ ... GET editing-region isn't within the specified range, a message showing the correct range is displayed. To override the default range message, use ON READERROR.

The lower boundary of the range is specified with , the upper boundary with . and must be character, numeric or date expressions that correspond to the data in the memory variable, array element or field. Either or can be omitted, but not both. If one boundary is omitted, the data you enter is checked against the specified boundary only.

ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
Note - The range isn't checked if you press Enter without changing the memory variable, array element or field.
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

SIZE ,
SIZE lets you control the length and height of an @ ... GET text-editing region. By default, a text-editing-region is one row high. The size of the region is determined by the length of the memory variable, array element or field or a PICTURE clause.

The height of the text-editing region in rows is specified with and the width in columns is specified with .

In FoxPro for Windows and FoxPro for Macintosh, the editing-region font determines the size of the editing-region. The editing-region font is specified with the FONT clause. If the FONT clause is omitted, the editing-region uses the font of its parent window (the main FoxPro window or a user-defined window).

VALID |
Use VALID to validate input. When you attempt to exit the GET editing-region, the VALID expression is evaluated.

A VALID clause greatly simplifies data validation when used with a user-defined function (UDF). If a UDF is called within a VALID clause in @ ... GET, the UDF should return a logical or numeric value.

ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
Note - Unlike the RANGE clause, a VALID clause is always executed when you exit the GET editing-region unless you press Esc. The RANGE clause is only executed when a change is made to the memory variable, array element or a field.
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ


If evaluates to a logical true (.T.), the input is considered correct and the editing-region is exited.

If evaluates to false (.F.), the value you entered is considered incorrect and a message is displayed directing you to reenter the data after pressing the Spacebar.

If a UDF validation routine performs a replacement on a field and the validation routine then returns false, the field replacement occurs but the previous field value is restored when you return from the UDF to the GET editing-region.


A VALID clause that includes a numeric expression is used to specify which object is activated after you exit the GET editing region. Objects are @ ... GET input fields, check boxes, lists, popups, spinners, text-editing regions and each individual button in a set of push, radio and invisible buttons. The numeric expression has one of the three effects:

When is 0, the cursor remains in the GET editing-region. The MESSAGE and ERROR error messages are suppressed. A special error message routine can be written as part of a UDF called by VALID.

If a UDF validation routine performs a replacement on a field and the validation routine returns 0, the field replacement occurs but the previous field value is restored when you return to the GET editing-region.

When is positive, specifies the number of objects to advance. For example, when the cursor is positioned on a GET editing-region and VALID returns 1, the next object is activated. If is greater than the number of remaining objects, the READ is terminated (unless READ CYCLE is issued to activate the objects).

When is negative, specifies the number of objects to move back. For example, when the cursor is positioned on a GET editing-region and VALID returns -1, the previous object is activated. If moves back past the first object, the READ is terminated (unless READ CYCLE is issued to activate the objects).

ERROR
ERROR lets you specify a custom error message displayed when a VALID clause evaluates to false (.F.). FoxPro displays in place of the default error message.

WHEN
WHEN allows or prohibits access to a GET editing-region based on the value of , which must be true (.T.) before the GET editing-region can be accessed. If WHEN is specified and is false (.F.), the GET editing-region cannot be accessed and the next object is activated.

COLOR SCHEME | COLOR
If you do not include a COLOR clause, the colors of an @ ... GET editing-region are determined by the color scheme for the main FoxPro window; if an @ ... GET editing-region is placed in a user-defined window, the window's color scheme determines the editing-region's colors.

Only the second color pair in a color scheme or color pair list affects the color of an @ ... GET editing-region.

The color of an @ ... GET editing-region can be specified by including the number of an existing color scheme in the COLOR SCHEME clause or a set of color pairs in the COLOR clause.

A color scheme is a set of 10 predefined color pairs. The color pairs in a color scheme can be changed with SET COLOR OF SCHEME. In FoxPro for MS-DOS the color pairs in a color scheme can also be changed in the Color Picker.

A color pair is a set of two letters separated by a forward slash. The first letter specifies the foreground color and the second letter specifies the background color.

For example, this color pair specifies a red foreground on a white background:

R/W

For a list of colors and their corresponding color letters, see SET COLOR Overview or Color Table by Color Pair.

A color pair can also be specified with a set of six RGB (Red Green Blue) color values separated by commas. The first three color values specify the foreground color and the second three color values specify the background color. The color values can range from 0 through 255.

The R/W color pair in the example above can also be specified with this RGB color pair:

RGB(255,0,0,255,255,255)

Only color pairs 2, 5, 6 and 10 in a color scheme or color pair list affect the @ ... GET editing-region colors.

Color Pair Editing Region
Number Attribute
ÄÄÄÄÄÄÄÄÄÄ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

2 @ ... GET editing region

5 Message

6 Selected @ ... GET editing region

10 Disabled @ ... GET editing region
Previous
Reply
Map
View

Click here to load this message in the networking platform