xHarbour Reference Documentation > Command Reference xHarbour Developers Network  

@...GET

Creates a Get object (entry field) and displays it to the screen

Syntax

@ <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>]

Arguments

@ <nRow>, <nCol>
The parameters are numeric values specifying the row and column coordinates for the screen output. The range for rows on the screen is 0 to MaxRow(), and for columns it is 0 to MaxCol(). The coordinate 0,0 is the upper left corner of the screen.
SAY <xSay>
This is a value of data type C, D, L or N which is displayed in front of the Get object. It is typically a character string indicating the name of the entry field.
PICTURE <cSayPict>
If specified, <cSayPict> is a character string holding the PICTURE format to be used for displaying <xSay>.
COLOR <cSayColor>
The parameter <cSayColor> is an optional character string defining the color for the output of <xSay>. It defaults to the current SetColor() setting. When <cSayColor> is specified as a literal color string, it must be enclosed in quotes.
GET <xVar>
This is a memory or field variable holding the value to be edited by the user.
PICTURE <cGetPict>
If specified, <cSayPict> is a character string holding the PICTURE format to be used for display and editing of <xVar>.
COLOR <cGetColor>
The parameter <cGetColor> is an optional character string defining the colors for the display and editing of <xVar>. It defaults to the current SetColor() setting. The first color value is used for the display of <xVar>, while the second defines the editing color. When <cGetColor> is specified as a literal color string, it must be enclosed in quotes.
WHEN <lWhen>
This is a logical expression or a code block returning a logical value. If specified, <lWhen> must result in .T. (true) to allow editing. If the expression yields .F. (false), the Get object is not editable but skipped.
VALID <lValid>
This is a logical expression or a code block returning a logical value. If specified, <lValid> must result in .T. (true) to end editing. When the result is .F. (false), the currently edited value of <xVar> is invalid and the user cannot leave the Get object unless editing is cancelled.
RANGE <xMinVal>, <xMaxVal>
When the value of <xVar> is numeric or a Date, the minimum and maximum values allowed for <xVar> can be specified with the RANGE clause. Note that RANGE and VALID are mutually exclusive.
MESSAGE <cMessage>
This is an optional character string displayed in the message row when a Get object is active. The message row is defined with the MSG AT option of the READ command.
SEND <msg>
This is an optional message to be sent to the Get object before it is displayed. Refer to the Get class for possible messages that can be sent to the Get object.
GUISEND <guimsg>
This is an optional message to be sent to a control object associated with a Get() object before both are displayed. Such control objects are created with extended @...GET commands:

Extended GET commands and control objects
CommandControl class
@...GET CHECKBOXHbCheckBox()
@...GET LISTBOXHbListBox()
@...GET PUSHBUTTONHbPushButton()
@...GET RADIOGROUPHbRadioGroup()
@...GET TBROWSETBrowse()

Description

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
@AOnly alphabetic characters are allowed.
@BNumbers are left justified.
@CCR is displayed after positive numbers.
@DDate values are displayed in the SET DATE format.
@EDates are displayed in British format, numbers in European format.
@KClears the Get when the first key pressed is alphanumeric.
@RInserts non-template characters for display.
@S<nWidth>Limits the display to <nWidth> characters and allows
 horizontal scrolling when the edited value exceeds <nWidth>.
@XDB is displayed after negative numbers.
@ZDisplays 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
AOnly alphabetic characters are allowed.
NOnly alphanumeric characters are allowed
XAny character is allowed.
LOnly T or F is allowed For logical values.
YOnly Y or N is allowed for logical values.
9Only 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.

Info

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

Example

// 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

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe