From Xojo Documentation

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

Property (As Segment )
aSegmentedButton.SegmentAt = newSegmentValue
SegmentValue = aSegmentedButton.SegmentAt

New in 2019r2

Supported for all project types and targets.

Returns the Segment instance at the index requested.


Use this property to change the properties of each Segment in the SegmentedButton.

Sample Code

This code loops through all the segments and changes their Titles:

Var seg As Segment
For position As Integer = 0 To SegmentedButton1.LastSegmentIndex
seg = SegmentedButton1.SegmentAt(position)
seg.Title = position.ToString

This code adds a new segment and then resizes all the segments so that they are visible:

Var seg As New Segment
seg.Title = "Seg " + Str(SegmentedButton1.SegmentCount)


// Resize all the segments
For i As Integer = 0 To SegmentedButton1.LastSegmentIndex
Var item As Segment = SegmentedButton1.SegmentAt(i)
item.Width = SegmentedButton1.Width / (SegmentedButton1.SegmentCount) - 2