|
|
|
|
|
- Overview
- Manipulating a Segmented Button control option
- Overview
- Identifying selected options
- Specific properties
Manipulating Segmented Button controls programmatically
WINDEV and WINDEV Mobile allow you to programmatically manipulate Segmented Button controls. Simply use the variable of the Segmented Button control in the code. A Segmented Button control is composed of several buttons, and each button corresponds to an option. Manipulating a Segmented Button control option Overview To manipulate a Segmented Button control option, simply specify the index of the desired option. For example, to retrieve the value of an option, use the following syntax: <Segmented Button control>[Option index].Property = <Property value> Identifying selected options To determine if an option is selected, simply retrieve the value of the option using the following syntax: <Option_Value> = <Segmented Button control>[Option index] In this case, <Option_Value> is a boolean set to: - True (1) if the option selected,
- False (0) if the option is not selected.
To get all the selected options: - Solution 1: Iterate over all the options in the control. Example:
Selected_options is string
FOR I = 1 TO SB_Test.Count
IF SB_Test[I] = 1 THEN
Selected_options += SB_Test[I].Caption + CR
END
END
- Solution 2: Use the value of the Segmented Button control.
- If the Segmented Button control is in "Radio Button" mode, the value corresponds to the selected option.
Example: Option 1 is selected:
Trace(SB_Test)
Trace(SB_Test.Value)
- If the Segmented Button control is in "Check Box" mode, the value is a string containing 0 (option not selected) and 1 (option selected).
Example: In this control, options 1 and 3 are selected and options 2 and 4 are not:
Trace(SB_Test)
Trace(SB_Test.Value)
Note: This syntax is only available from version 2025 Update 1. In previous versions, the value of the control cannot be determined or initialized. An error is displayed. These syntaxes can also be used to initialize the value of a Segmented Button control.
Specific properties The following properties can be used on a Segmented Button control option: | | Grayed | Disables or enables an option. Note: This property is available on Segmented Button control options only from version 2025 Update 1. | Caption | Gets and sets the text of an option. | Font | Sets the font used for an option. | Value | Allows you to determine if an option is selected, and to select or deselect it. | Visible | Shows or hides an option. |
For a complete list of WLanguage properties that can be used with Segmented Button controls or with its options, see Segmented Button control properties.
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|