SegmentedControlItem.Width

From Xojo Documentation

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

Property (As Integer )
aSegmentedControlItem.Width = newIntegerValue
or
IntegerValue = aSegmentedControlItem.Width

New in 2010r4

Supported for all project types and targets.

The Width of the segment. The default is that all the segments are evenly wide.

Example

This example increases the width if the segmented is selected. Notice that it calls SizeToFit after it has finished testing all the segments.

// count down so we avoid re-evaluating the ubound all the time
For i As Integer = SegmentedControl1.Items.Ubound DownTo 0

// get the reference to the segment
Dim s As SegmentedControlItem = SegmentedControl1.Items(i)

//see if the segment was selected
If s.Selected Then
// it is so we want to 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
SegmentedControl1.SizeToFit