From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

Property (As Integer )
aSegmentedButton.SelectedSegmentIndex = newIntegerValue
IntegerValue = aSegmentedButton.SelectedSegmentIndex

New in 2019r2

Supported for all project types and targets.

Used to get or set the selected segment number. The first segment is numbered zero.


A value of -1 means no selection. SelectedSegmentIndex may be set using the Properties pane to set the default value of the SegmentedButton control. SelectedSegmentIndex is only useful when SelectionStyle is set to Single. SelectedSegment will provide you with the Segment for the selected segment.

For multi-selection SegmentedButtons this returns the last segment that was selected.

If SelectionStyle is set to Multiple, you must use SegmentAt to check each segment's Selected property to see if it's True or not.


The following example changes the selected segment to the third segment:

SegmentedButton1.SelectedSegmentIndex = 2