Segment

From Xojo Documentation

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

Class (inherits from Object)


New in 2019r2

A segment of a SegmentedButton.

Properties
Caption Icon Tooltip
Enabled Selected Width

Notes

You access the segments of a DesktopSegmentedButton from the control’s SegmentAt method. It requires a parameter that specifies the segment that you want to address. For example, the following code selects all the segments in a loop. For each segment, it uses the Selected property to determine whether the segment is selected.

// count down to avoid re-evaluating the Ubound all the time
For i As Integer = SegmentedButton1.LastSegmentIndex DownTo 0

// get the reference to the segment
Var s As Segment = SegmentedButton1.SegmentAt(i)

// see if the segment was selected
If s.Selected Then
// it is selected so increase this segment in size
s.Width = s.Width + 2
End If
Next

// make sure the segmented control knows to resizes its drawing boundaries or you can get weird effects
SegmentedButton1.ResizeSegmentsToFit

See Also

DesktopSegmentedButton control.