[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 @...GET
 GET system overview.
------------------------------------------------------------------------------

The get system has become multi-faceted with the introduction of the USING
clause.  The following is the all encompassing syntax.  Not all clauses are
available for all GET types.

 Syntax:

     @ <nRow>, <nCol>
        [SAY <exp>
           [PICTURE <cSayPicture>]
           [COLOR <cColorString>]]
        GET <idVar>
           [PICTURE <cGetPicture>]
           [COLOR <cColorString>]
           [WHEN <lPreCondition>]
           [VALID <lPostCondition>]
           [USING CHECK | RADIO | STANDARD | LISTBOX]
           [HIDDEN]
           [LIST <aList> | DBLIST <aDBList> | USERLIST <bUserList>]
           [MASTERVAR <xVar>]
           [MASTERAREA <cAlias>]
           [MESSAGE <cSayMessage>]
           [WITH <xWith>]
           [SEND <xMessage>]

     OR

     @ <nRow>, <nCol>
        [SAY <exp>
           [PICTURE <cSayPicture>]
           [COLOR <cColorString>]]
        BUTTON <cExp>
           [COLOR <cColorString>]
           [WHEN <lPreCondition>]
           [ACTION <lAction>]
           [HIDDEN]
           [MESSAGE <cSayMessage>]


 For a complete explanation of each argument look under the individual GET
 type heading (STANDARD, RADIO, CHECK, LISTBOX and BUTTON).

 Example:

 #INCLUDE "CUACLIP.CH"

 FUNCTION Demo( lAppend )

 LOCAL GetList      := {}
 STATIC cName       := "                    "
 STATIC nSalutation := 0
 STATIC cCity       := "                    "
 STATIC cPhone      := "          "
 STATIC lModem      := .F.
 STATIC nBaudRate   := 0
 LOCAL aSalutations := {{{1,"Mr."},{2,"Mrs."},{3,"Miss"},{4,"Ms."}}}
 LOCAL aBaudRates := {{{ 3,"300  "},{12,"1200 "},{24,"2400 "},{48,"4800 "}},;
                      {{96,"9600 "},{19,"19200"},{38,"38400"},{57,"57600"}}}
 LOCAL aCities      := {"Ottawa              ",;
                        "Toronto             ",;
                        "Montreal            ",;
                        "Vancouver           ",;
                        "Winnipeg            ",;
                        "Calgary             ",;
                        "Edmonton            ",;
                        "Hamilton            ",;
                        "Regina              ",;
                        "Saskatoon           ",;
                        "St. John's          ",;
                        "Halifax             "}
 LOCAL cOldColor    := SETCOLOR("W/RB,RB/W,,,+W/RB")
 LOCAL cOldMenu     := SetMenuColor("+W/BG,B/BG,N+/BG,W/BG")
 LOCAL cOldGet      := SetGetColor("+W/RB,RB/W,W/RB")
 LOCAL cOldPop      := SetPopColor("+W/R,R/W,W/R")
 LOCAL cOldScreen   := ShadowBox( 9, 12, 22, 67, 2, "+W/RB")
 LOCAL lOldUpdate   := Updated( FALSE )
 DEFAULT lAppend TO FALSE

 /* The radio button array structure is an array containing another array
    for each row of buttons to be displayed.  Each one of these "row" arrays
    contain an array for each button on that row.  Each one of the "button"
    arrays contain two elements, 1 - a value for the variable and
    2 - the corresponding character prompt for that value.  The vartype() of
    the first element must match that of the variable being represented by
    the radio button.
    {
      { <xValue1>, <cPrompt1> } [,{ <xValue#>, <cPrompt#> }, ... ] }
    [,{ <xValue#>, <cPrompt#> } [,{ <xValue#>, <cPrompt#> }, ... ] }, ... ]
    }
 */

 IF lAppend
    cName       := "                    "
    nSalutation := 0
    cCity       := "                    "
    cPhone      := "          "
    lModem      := .F.
    nBaudRate   := 0
 ENDIF

 @ 10,16 SAY "Name:  "     GET cName DBLIST {"employee",,,{||field->name}};
    MESSAGE "What is the name of the person..."
 @ 11,16 SAY "Salutation:" GET nSalutation USING Radio WITH aSalutations ;
    MESSAGE "Salutation please..."
 @ 12,16 SAY "City:  "     GET cCity LIST aCities ;
    MESSAGE "The city in which the person lives.."
 @ 13,16 SAY "Phone: "     GET cPhone PICTURE "@R (999) 999-9999" ;
    WHEN !EMPTY(cName) HIDDEN MESSAGE "Telephone number please..."
 @ 14,16 SAY "Modem?:"     GET lModem USING Check ;
    VALID (IIF(!lModem,nBaudRate:=0,NIL),TRUE) ;
    MESSAGE "Does the person have a modem?..."
            // Notice the trick to clear the baudrate field.
 @ 15,16 TO 18,63  //draw a box to contain the baud rates
 @ 15,16 SAY "Baud Rate"
 @ 16,19 GET nBaudRate USING Radio WITH aBaudRates WHEN lModem ;
    MESSAGE "What baud rate does their modem function at?..."

 @ 20,16 BUTTON "Save" WHEN UpDated() ACTION ;
    IIF(ValidGets() == 0,OrigChanged(),FALSE) ;
    MESSAGE "Save the work and continue..."

 @ 20,COL()+3 BUTTON "Save/Exit" WHEN UpDated() ACTION ;
    IIF(ValidGets() == 0,!OrigChanged(),FALSE)  ;
    MESSAGE "Save the work and exit..."

 @ 20,COL()+3 BUTTON "Abort" ACTION UndoGets() ;
    MESSAGE "Abort your work and exit..."
 READ

 SETCOLOR( cOldColor )
 SetMenuColor( cOldMenu )
 SetGetColor( cOldGet )
 SetPopColor( cOldPop )
 KillBox( cOldScreen )
 Updated( lOldUpdated )

 RETURN NIL


See Also: READ SetMessColor()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson