Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSSegmentedControlMBS class.

NSSegmentedControlMBS.Constructor

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Controls MBS MacCocoa Plugin 12.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Creates a new path control with size 100/100 and position 0/0
Example
dim t as new NSSegmentedControlMBS

On success the handle property is not zero.

See also:

NSSegmentedControlMBS.Constructor(Handle as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Controls MBS MacCocoa Plugin 12.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Creates an object based on the given NSPathControl handle.
Example
dim t as new NSSegmentedControlMBS(0, 0, 100, 100)
dim v as new NSSegmentedControlMBS(t.handle)

MsgBox str(v.Bounds.Width)+" x "+str(v.Bounds.Height)

The handle is casted to a NSSegmentedControl and the plugin retains this handle.

See also:

NSSegmentedControlMBS.Constructor(left as Double, top as Double, width as Double, height as Double)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Controls MBS MacCocoa Plugin 12.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Creates a new path control with the given size and position.
Example
dim x as new NSSegmentedControlMBS(0, 0, 100, 100)

On success the handle property is not zero.

See also:

NSSegmentedControlMBS.imageForSegment(segment as Integer) as NSImageMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Controls MBS MacCocoa Plugin 12.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
The image for the specified segment.

image: The image to apply to the segment or nil if you want to clear the existing image. Images are not scaled to fit inside a segment. If the image is larger than the available space, it is clipped.
segment: The index of the segment whose image you want to set. This method raises an NSRangeException if the index is out of bounds.
(Read and Write computed property)

Some examples using this property:

NSSegmentedControlMBS.imageScalingForSegment(segment as Integer) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Controls MBS MacCocoa Plugin 12.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
The scaling mode used to display the specified segment's image.

scaling: One of the image scaling constants. For a list of possible values, see constants.
segment: The index of the segment whose enabled state you want to get. This method raises an NSRangeException if the index is out of bounds.
Available in Mac OS X v10.5 and later.
(Read and Write computed property)

NSSegmentedControlMBS.isEnabledForSegment(segment as Integer) as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Controls MBS MacCocoa Plugin 12.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
The enabled state of the specified segment.

True to enable the segment; otherwise, false to disable it.
segment: The index of the segment you want to enable or disable. This method raises an NSRangeException if the index is out of bounds.
(Read and Write computed property)

Some examples using this property:

NSSegmentedControlMBS.isSelectedForSegment(segment as Integer) as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Controls MBS MacCocoa Plugin 12.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
The selection state of the specified segment.

True if you want to select the segment; otherwise, false.

segment: The index of the segment whose selection state you want to set. This method raises an NSRangeException if the index is out of bounds.

If the receiver allows only a single selection, this method deselects any other selected segments.
(Read and Write computed property)

NSSegmentedControlMBS.labelForSegment(segment as Integer) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Controls MBS MacCocoa Plugin 12.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
The label for the specified segment.

label: The label you want to display in the segment. If the width of the string is greater than the width of the segment, the string's text is truncated during drawing.
segment: The index of the segment whose label you want to set. This method raises an NSRangeException if the index is out of bounds.
(Read and Write computed property)

Some examples using this property:

NSSegmentedControlMBS.makeNextSegmentKey

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Controls MBS MacCocoa Plugin 12.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Selects the next segment.

The next segment is the one to the right of the currently selected segment. For the last segment, the selection wraps back to the beginning of the control.

Some examples using this method:

NSSegmentedControlMBS.makePreviousSegmentKey

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Controls MBS MacCocoa Plugin 12.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Selects the previous segment.

The previous segment is the one to the left of the currently selected segment. For the first segment, the selection wraps around to the last segment of the control.

Some examples using this method:

NSSegmentedControlMBS.menuForSegment(segment as Integer) as NSMenuMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Controls MBS MacCocoa Plugin 12.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
The menu for the specified segment.

menu: The menu you want to add to the segment or nil to clear the current menu. This menu is displayed when the user clicks and holds the mouse button while the mouse is over the segment.
segment: The index of the segment whose menu you want to set. This method raises an NSRangeException if the index is out of bounds.

Adding a menu to a segment allows that segment to be used as a pop-up button.
(Read and Write computed property)

Some examples using this property:

NSSegmentedControlMBS.selectSegmentWithTag(Tag as Integer) as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Controls MBS MacCocoa Plugin 12.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Selects the segment with the specified tag.

tag: The tag associated with the desired segment.
True if the segment was selected successfully; otherwise, false.

Typically, you use Interface Builder to specify the tag for each segment. You may also set this value programmatically using the setTag:forSegment: method of NSSegmentedCell.

NSSegmentedControlMBS.tagForSegment(segment as Integer) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Controls MBS MacCocoa Plugin 12.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
The tag value for the segment.

segment: The index of the segment whose width you want to get. This method raises an NSRangeException if the index is out of bounds.

The tag is an integer you define to identify your items.
(Read and Write computed property)

Some examples using this property:

NSSegmentedControlMBS.ToolTipForSegment(segment as Integer) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Controls MBS MacCocoa Plugin 12.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
The tool tip for the specified segment.

segment: The index of the segment whose tool tip you want to set. This method raises an NSRangeException if the index is out of bounds.

Tool tips are currently not displayed. Apple may change that in the future.
(Read and Write computed property)

NSSegmentedControlMBS.widthForSegment(segment as Integer) as Double

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Controls MBS MacCocoa Plugin 12.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
The width of the specified segment.

width: The width of the segment, measured in points. Specify the value 0 if you want the segment to be sized to fit the available space automatically.
segment: The index of the segment whose width you want to set. This method raises an NSRangeException if the index is out of bounds.
(Read and Write computed property)

Some examples using this property:

The items on this page are in the following plugins: MBS MacCocoa Plugin.


The biggest plugin in space...