[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
@...RADIO
Create and display a multi-choice RADIO BUTTON.
------------------------------------------------------------------------------
Syntax:
@ <nRow>, <nCol>
[SAY <exp>
[PICTURE <cSayPicture>]
[COLOR <cColorString>]]
GET <idVar>
[COLOR <cColorString>]
[WHEN <lPreCondition>]
[VALID <lPostCondition>]
USING RADIO
WITH <aSelection>
[MASTERVAR <xVar>]
[MASTERAREA <cArea>]
[MESSAGE <cSayMessage>]
[SEND <xMessage>]
Arguments:
<nRow> and <nCol> specify the row and column coordinates for
the operation. If the SAY clause is present, <nRow> and <nCol> specify
the coordinates for the SAY, and the GET is displayed to the right of
the SAY output. If the SAY clause is not present, <nRow> and <nCol>
directly specify the coordinates for the GET. In either case, output
which extends beyond the visible extent of the display is clipped and
does not appear.
SAY <exp> displays the value of <exp> at the specified
coordinates. If the PICTURE <cSayPicture> clause is specified, <exp>
is formatted according to the rules of SAY pictures.
MESSAGE <cSayMessage> attaches the <cSayMessage> to the get so it
may be displayed whenever the GET is infocus and the SET MESSAGE TO has
been set to a number greater than 0.
WHEN <lPreCondition> specifies an expression that must be satisfied
before the cursor will be allowed to enter the GET during a READ.
VALID <lPostCondition> specifies an expression that must be
satisfied before the cursor will be allowed to leave the GET during a
READ.
WITH <aSelection> is used to pass the array of radio buttons to the get.
The array is made up of an array containing arrays of rows of button
arrays. That is to say that many rows of radio buttons can be passed
by including many second level arrays. The button array contains two
elements - the first si the expression to store in th GET and the
second is the character string representing the radio button.
Ex.
{ { { 1, "Mr." }, { 2, "Mrs." }, { 3, "Miss" }, { 4, "Ms." } } }
is a single line radio button.
{ { { 3, "300 "}, {12, "1200 "}, {24, "2400 "}, {48,"4800 "}},;
{ {96, "9600 "}, {19, "19200"}, {38, "38400"}, {57,"57600"} } }
is a two line radio button.
MASTERVAR <xVar> is an optional variable expression used to represent
the original source of the get variable. This can be used in conjunction
with the OrigChanged() function which checks all current gets against
their origin.
MASTERAREA <cArea> is an optional database area/alias in which the
<xVar> resides. This defaults to the current work area.
SEND <xMessage> is used to send (:) a message to the get object.
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 ",;
"Saskitoon ",;
"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
Files: Library is CUACLIP.LIB.
See Also:
@...GET
READ
SetRadioChar()
SetMessColor()
EX3.PRG
EX5.PRG
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson