xHarbour Reference Documentation > Command Reference |
|
|
@...GET RADIOGROUP
Creates a Get object as radio button group and displays it to the screen.
Syntax
@ <nTop>, <nLeft>, <nBottom>, <nRight> ;
GET <nVar>|<cVar> ;
RADIOGROUP <aRadioButtons> ;
[CAPTION <cCaption>] ;
[MESSAGE <cMessage>] ;
[WHEN <lWhen>] ;
[VALID <lValid>] ;
[COLOR <cColor>] ;
[FOCUS <bFocus>] ;
[SEND <msg>] ;
[GUISEND <guimsg>]
Arguments
- @ <nTop>, <nLeft>, <nBottom>, <nRight>
- Numeric values indicating the screen coordinates for the upper left and
the lower right corner of the radio button group. 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.
- GET <nVar>|<cVar>
- This is the edited variable. It must be initialized either with a numeric
value or as a character string. If it is numeric, the variable receives the
ordinal position of the selected radio button held in <aRadioButtons> when the selection ends.
When it is a character string, the string data of the selected radio button of <aRadioButtons>
is assigned.
- RADIOGROUP <aRadioButtons>
- This is a one dimensional array holding HbRadioButton() objects. They
display individual that are displayed within the radio group.
- CAPTION <cCaption>
- This is a character string displayed as caption of the radio button group. The caption string
may include an ampersand character (&) which marks the next character as accelerator key.
Pressing the accelerator key allows the user to jump directly to the radio button group.
- MESSAGE <cMessage>
- This is an optional character string displayed in the message row when the
radio button group has input focus. The message row is defined with the MSG AT option
of the READ command.
- 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 selection. If the
expression yields .F. (false), the radio button group cannot receive input focus.
- 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 selection in the radio button group. When the
result is .F. (false), the currently selected option is invalid and the user cannot
leave the radio button group unless the selection is cancelled.
- COLOR <cColor>
- The parameter <cColor> is an optional character string defining the colors
for the display of the list box and its caption. It defaults to the current
SetColor() setting. <cColor> must have up to eight color values
(see ColorSelect()). They are used as follows:
Color values for radio button groups
Color value | Description |
1 | Color for the border around the radio button group |
2 | Color for the caption |
3 | Color for the accelerator key |
- FOCUS <bFocus>
- This is an optional code block which is evaluated when the radio button group receives
input focus. The code block is evaluated without parameters.
- 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 the HbRadioGroup() object associated
with the Get() object before both are displayed. Refer to the HbRadioGroup class
for possible messages that can be sent to the radio button group object.
Description
The @...GET RADIOGROUP command creates a Get() object and assigns a HbRadioGroup() object
to the oGet:control instance variable. The HbRadioGroup() object displays all
HbRadioButton() objects stored in the <aRadioButtons> array in text mode and allows a user to select
one of the redio buttons while the READ command is active. The position or the data of the
selected radio button is assigned to the edited variable when READ is terminated.
The Get object created with @...GET RADIOGROUP is stored in the current Getlist array. The Get object communicates
with the associated HbRadioGroup object while the READ command is active. This communication ensures that focus
and state changes are properly displayed on the screen.
Info
Example
// The example demonstrates how radio button groups can be integrated
// in the Get list and are filled with radio buttons.
#include "Inkey.ch"
PROCEDURE Main
LOCAL aRadio1[3], aRadio2[4]
LOCAL nSpeed, cPages
LOCAL cColor1 := "W/B,W+/B,R/W+"
LOCAL cColor2 := "N/BG,N/BG,GR+/BG,GR+/BG,N/BG,W+/BG,GR+/BG"
SET EVENTMASK TO INKEY_ALL
SET COLOR TO N/BG
CLS
nSpeed := 1 //default to the first item.
aRadio1[ 1 ] := HbRadioButton():new( 4, 22, "&slow" )
aRadio1[ 2 ] := HbRadioButton():new( 5, 22, "&medium" )
aRadio1[ 3 ] := HbRadioButton():new( 6, 22, "&fast" )
AEval( aRadio1, {|o| o:colorSpec := cColor2 } )
cPages := "all"
aRadio2[ 1 ] := HbRadioButton():new( 10, 22, "&first page", "this" )
aRadio2[ 2 ] := HbRadioButton():new( 11, 22, "&this page" , "first")
aRadio2[ 3 ] := HbRadioButton():new( 12, 22, "&last page" , "last" )
aRadio2[ 4 ] := HbRadioButton():new( 13, 22, "&all pages" , "all" )
AEval( aRadio2, {|o| o:colorSpec := cColor2 } )
@ 3, 20, 7, 40 GET nSpeed ;
RADIOGROUP aRadio1 ;
CAPTION "&Speed" ;
COLOR cColor1
@ 9, 20, 14, 40 GET cPages ;
RADIOGROUP aRadio2 ;
CAPTION "&Pages" ;
COLOR cColor1
READ
? nSpeed, cPages
RETURN
Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe