ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

New WINDEV and WINDEV Mobile 2025 feature!
Help / Developing an application or website / Controls, windows and pages / Controls: Available types / Segmented Button control
  • Overview
  • Manipulating a Segmented Button control option
  • Overview
  • Identifying selected options
  • Specific properties
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Manipulating Segmented Button controls programmatically
Overview
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.
A series of WLanguage functions can be used to add, insert or delete options in a Segmented Button control. For more details, see Segmented Button control functions.
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) // Returns 1
      Trace(SB_Test.Value) // Returns 1
    • 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) // Returns 1010
      Trace(SB_Test.Value) // Returns 1010
      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:
GrayedDisables or enables an option.
Note: This property is available on Segmented Button control options only from version 2025 Update 1.
CaptionGets and sets the text of an option.
FontSets the font used for an option.
ValueAllows you to determine if an option is selected, and to select or deselect it.
VisibleShows 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.
Minimum version required
  • Version 2025
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 02/05/2025

Send a report | Local help