SegmentedButton.SelectedSegmentIndex

From Xojo Documentation

Property (As Integer )
aSegmentedButton.SelectedSegmentIndex = newIntegerValue
or
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.

Notes

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.

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.

Example

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

SegmentedButton1.SelectedSegmentIndex = 2