PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
This content has been translated automatically. Click here to view the French version.
  • Overview
  • Initializing the choice of a Radio Button control
  • Displaying a Radio Button control with no default option
  • Retrieving the option selected in a Radio Button control
  • Case of a Radio Button control that returns an integer
  • For a Radio Button control that returns a value
  • Pre-filled SWITCH on the Radio Button controls
  • Modifying the caption of a Radio Button control
  • Case of Radio Button controls with sub-captions
  • Modifying the colors of captions for the options found in a Radio Button control
  • Properties specific to the Radio Button controls
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Overview
WINDEV, WEBDEV and WINDEV Mobile allow you to handle a Radio Button control through programming. To do so, use the variable of Radio Button control in the code.
Regardless of the type of radio button, each option can be associated with:
  • an integer. This integer can take a value from 1 to N, N being the total number of options found in the radio button. The first option is the option #1, the second option is the option #2, ... The options are numbered from top to bottom and from left to right.
  • WINDEVUniversal Windows 10 App a specific returned value . This returned value is specified in the "Content" tab of the control description window.
WINDEVUniversal Windows 10 App Using the numbering or the returned values?
The method for programming the radio buttons that return an integer differs from the method for programming the radio buttons that return a value. The benefit of using returned values is visible when inserting or moving an option in the radio button:
  • If the radio button returns an integer, inserting or moving an option in the radio button forces you to revise the entire code for managing the value of the radio button (to manage the change in the numbers).
  • If the radio button returns a specific value, inserting an option into the radio button only requires to take the new option into account. Moving an option requires no modification.
WINDEVAndroidiPhone/iPad Remark: Several WLanguage functions are used to add, insert or delete options in a Radio Button control. For more details, see Radio Button control management functions.
Initializing the choice of a Radio Button control
By default, the first option is selected when a Radio Button control is displayed.
To check an option of a Radio Button control:
  • if the Radio Button control returns an integer, use the following syntax:
    <Nom du champ Sélecteur> = <Indice de l'option>
  • if the Radio Button control returns a specific value (in WINDEV or WINDEV Mobile only), use the following syntax:
    <Nom du champ Sélecteur> = <Valeur de l'option>
The selection of an option unchecks the option that is currently selected.
Remark: If the control is associated with a data file item, the assignment is automatically performed via:
For more details, see Binding a Radio Button control to an item.
WINDEVWEBDEV - Server codeUniversal Windows 10 AppAndroidiPhone/iPadJava

Displaying a Radio Button control with no default option

A Radio Button control is always positioned on a position (1 by default).
To display a Radio Button control with no default option, all you have to do is assign the initial control value to:
  • -1 for a Radio Button control that returns an integer,
  • "" (empty string) for a Radio Button control that returns a value.
Remark: A Radio Button control with no default value cannot be accessed by TAB.
Example:
// Affichage du champ Sélecteur sans valeur initiale
SEL_MonSélecteur = -1
// ou SEL_MonSélecteur = ""
Retrieving the option selected in a Radio Button control

Case of a Radio Button control that returns an integer

To retrieve the subscript of the option selected in the Radio Button control, use the following syntax:
<Indice de l'option> = <Nom du champ Sélecteur>

In this case, the <Option subscript> parameter is an integer corresponding to the number of the selected option.
To find out the caption of the option selected in the Radio Button control, use the following syntax:
<Libellé de l'option> = <Nom du champ Sélecteur>[<Nom du champ Sélecteur>].Libellé

Remark: If the control is associated with an item found in a data file, the value typed is automatically retrieved by using:
For more details, see Linking a Radio Button control to an item.
WINDEVUniversal Windows 10 App

For a Radio Button control that returns a value

To retrieve the value of the option selected in the Radio Button control, use the following syntax:
<Valeur de l'option> = <Nom du champ Sélecteur>

In this case, the <Option value> parameter is a character string corresponding to the returned value of the selected option.
Remark: The Property ReturnedValue also allows to know and modify the value returned by each option of the Radio Button control.
To retrieve the subscript of selected option, a specific process must be performed. Example:
// Valeur renvoyée de l'option sélectionnée
Résultat1 = SEL_PlatDuJour
// Recherche de l'indice de l'option sélectionnée
Indice is int
I is int
FOR I = 1 _TO_ SEL_PlatDuJour.Occurrence
IF SEL_PlatDuJour[I].ValeurRenvoyée = Résultat1 THEN Indice = I
END
To find out the caption of the option selected in the Radio Button control, use the following syntax:
<Libellé de l'option> = <Nom du champ Sélecteur>[<Indice de l'option>].Libellé
Remark: If the control is associated with an item found in a data file, the value typed is automatically retrieved by using:
For more details, see Linking a Radio Button control to an item.
Versions 18 and later

Pre-filled SWITCH on the Radio Button controls

When typing the SWITCH statement relative to a Radio Button control, the code editor automatically adds the CASE corresponding to the different options of the Radio Button control. The caption of each option is automatically added in line comment.
For example:
  • Code for a Radio Button control that returns an integer: typing "SWITCH RADIO_Title" in the code editor displays:
    Code for a Radio Button control that returns an integer
  • Code for a Radio Button control that returns a value: typing "SWITCH RADIO_TodaysMenu" in the code editor displays:
    Code for a Radio Button control that returns a value
New in version 18

Pre-filled SWITCH on the Radio Button controls

When typing the SWITCH statement relative to a Radio Button control, the code editor automatically adds the CASE corresponding to the different options of the Radio Button control. The caption of each option is automatically added in line comment.
For example:
  • Code for a Radio Button control that returns an integer: typing "SWITCH RADIO_Title" in the code editor displays:
    Code for a Radio Button control that returns an integer
  • Code for a Radio Button control that returns a value: typing "SWITCH RADIO_TodaysMenu" in the code editor displays:
    Code for a Radio Button control that returns a value

Pre-filled SWITCH on the Radio Button controls

When typing the SWITCH statement relative to a Radio Button control, the code editor automatically adds the CASE corresponding to the different options of the Radio Button control. The caption of each option is automatically added in line comment.
For example:
  • Code for a Radio Button control that returns an integer: typing "SWITCH RADIO_Title" in the code editor displays:
    Code for a Radio Button control that returns an integer
  • Code for a Radio Button control that returns a value: typing "SWITCH RADIO_TodaysMenu" in the code editor displays:
    Code for a Radio Button control that returns a value
Modifying the caption of a Radio Button control
Libellé is used to:
  • change the caption of Radio Button control:
    <Nom du champ Sélecteur>.Libellé = <Libellé>
  • change the caption of all options found in the Radio Button control:
    The options must be separated by the TAB character.
    You have the ability to specify the first options only.
    <Nom du champ Sélecteur>.Libellé = <Option 1>+TAB+<Option 2>+TAB+<Option 3> ...
  • retrieve and modify the caption of an option:
    // Récupération du sous-libellé
    <Sous-Libellé> = <Nom du champ Sélecteur>[<Indice de l'option>].SousLibellé

    // Modification du sous-libellé
    <Nom du champ Sélecteur>[<Indice de l'option>].SousLibellé = <Nouveau sous-libellé>
WINDEVUniversal Windows 10 AppiPhone/iPad

Case of Radio Button controls with sub-captions

SubCaption is used to find out and modify the sub-captions of the options found in the Radio Button control.
// Récupération du sous-libellé
<Sous-Libellé> = <Nom du champ Sélecteur>[<Indice de l'option>].SousLibellé

// Modification du sous-libellé
<Nom du champ Sélecteur>[<Indice de l'option>].SousLibellé = <Nouveau sous-libellé>
Modifying the colors of captions for the options found in a Radio Button control
WINDEVJava To modify the colors of captions for the options found in a Radio Button control, you have the ability to use the following syntax:
<Nom du champ Sélecteur>..Libellé = gStylo(<Couleur option 1>) + ...
<Libellé option 1> + TAB + ...
gStylo(<Couleur option N>) + <Libellé option N>
<Color of option> corresponds to:
Properties specific to the Radio Button controls
The following properties are used to manage the characteristics of a Radio Button control by programming.
HorizontalAlignmentUsed to find out and modify the horizontal alignment of a control.
VerticalAlignmentUsed to find out and modify the vertical alignment of a control.
ColorUsed to find out and modify the color of the text for the options found in the Radio Button control.
BackgroundColorUsed to find out and modify the background color of the Radio Button control.
NumberColumnUsed to find out the number of columns in a Radio Button control.
CountUsed to find out the number of options in a Radio Button control.
SubCaptionUsed to find out and modify the sub-caption of an option found in a Radio Button control.
InitialValueUsed to find out the initial value of a Radio Button control.
ReturnedValueUsed to find out and modify the value returned by an option found in a Radio Button control.

To find out the entire list of WLanguage properties that can be used with a Radio Button control, see Properties associated with a Radio Button control.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment