xHarbour Reference Documentation > Command Reference |
Creates a Get object (entry field) and displays it to the screen
@ <nRow>, <nCol> ; [SAY <xSay> [PICTURE <cSayPict>] COLOR <cSayColor>] ; GET <xVar> [PICTURE <cGetPict>] [COLOR <cGetColor>] ; [WHEN <lWhen>] ; [VALID <lValid> | RANGE <xMinVal>, <xMaxVal> ] ; [MESSAGE <cMessage> ] ; [SEND <msg>] ; [GUISEND <msg>]
Extended GET commands and control objects
Command | Control class |
---|---|
@...GET CHECKBOX | HbCheckBox() |
@...GET LISTBOX | HbListBox() |
@...GET PUSHBUTTON | HbPushButton() |
@...GET RADIOGROUP | HbRadioGroup() |
@...GET TBROWSE | TBrowse() |
The @...GET command creates a new object of the Get class, adds it to the GetList array and displays it to the screen. The GetList array is a default PUBLIC varible that is reserved for being used by the Get system. It is recommended, however, to declare a new variable named GetList and initialize it with an empty array before the first @...GET command is issued. The value to be edited is held in the variable <xVar>.
If the SAY clause is used, <xSay> is displayed at the screen position <nRow>, <nCol>, followed by the value of <xVar>. The PICTURE <cSayPict> clause optionally specifies a picture format string for the display of <xSay>, while the COLOR <cSayColor> defines the color. Refer to SetColor() and Transform() for color values and picture formatting of the SAY clause.
If PICTURE <cGetPict> is specified, it defines the picture formatting of <xVar> for display and editing. See the table below for these picture formatting rules.
If the WHEN clause is specified, it determines wether or not a Get object can receive input focus during the READ command. The <lWhen> expression must be a logical expression or a code block returning a logical value. If <lWhen> yields .T. (true) the corresponding Get object receives input during READ. When it is .F. (false) this Get object is skipped during READ.
The VALID clause is similar to the WHEN clause, but it is evaluated during the READ command before the user advances to the next get object, i.e. before the current Get object looses input focus. If <lValid> yields .T. (true), the next Get object receives input focus. Otherwise, the input focus remains with the current Get object and the user must change the edited value until <lValid> results in .T. (true), or editing is cancelled.
Instead of the VALID clause, the RANGE option can be used for numeric values and Dates. The minimum and maximum value valid for <xVar> must then be specified with <xMinVal> and <xMaxVal>.
The PICTURE clause <cGetPict> defines the formatting of <xVar> for display and editing. It is a character string defining a picture function and/or template. A picture function begins with the @ character. If the picture string contains both, the picture function must appear first, followed by a blank space and the template characters.
PICTURE functions for editing
@A | Only alphabetic characters are allowed. |
---|---|
@B | Numbers are left justified. |
@C | CR is displayed after positive numbers. |
@D | Date values are displayed in the SET DATE format. |
@E | Dates are displayed in British format, numbers in European format. |
@K | Clears the Get when the first key pressed is alphanumeric. |
@R | Inserts non-template characters for display. |
@S<nWidth> | Limits the display to <nWidth> characters and allows |
horizontal scrolling when the edited value exceeds <nWidth>. | |
@X | DB is displayed after negative numbers. |
@Z | Displays zero values as blanks. |
@! | Forces all letters to uppercase. |
@( | Displays negative numbers in parentheses with leading spaces. |
@) | Displays negative numbers in parentheses without leading spaces. |
PICTURE templates for editing
A | Only alphabetic characters are allowed. |
---|---|
N | Only alphanumeric characters are allowed |
X | Any character is allowed. |
L | Only T or F is allowed For logical values. |
Y | Only Y or N is allowed for logical values. |
9 | Only digits, including signs, are allowed. |
# | Only digits, signs and blank spaces are allowed. |
! | Alphabetic characters are converted to uppercase. |
$ | The dollar sign is displayed in place of leading |
spaces for numbers. | |
* | Numbers are padded with the asterisk. |
. | Position of the decimal point. |
, | Position of the comma. |
See also: | @...SAY, @...CLEAR, Col(), Get(), GetNew(), GetReader(), READ, ReadModal(), Row() |
Category: | Get system , Input commands |
Source: | rtl\getsys.prg, rtl\tgetlist.prg |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example displays two Get entry fields using // different picture formatting rules PROCEDURE Main() LOCAL GetList := {} LOCAL cVar := Space(50) LOCAL nId := 0 CLS @ 3,1 SAY "Name" GET cVar PICTURE "@!S 30" @ 4,1 SAY "Id " GET nId PICTURE "999.999" READ ? "The name you entered is", cVar ? "The id you entered is" , nId RETURN
http://www.xHarbour.com