Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

NSSegmentedControlMBS class

Super class: NSControlMBS

Type Topic Plugin Version macOS Windows Linux Console & Web iOS
class Cocoa Controls MBS MacCocoa Plugin 12.1 Yes No No Yes, macOS only No
Function: The plugin class for a Cocoa NSSegmentedControl.
Notes:
An NSSegmentedControl object implements a horizontal button made of multiple segments.

The NSSegmentedControl class uses an NSSegmentedCell class to implement much of the control's functionality. Most methods in NSSegmentedControl are simply "cover methods" that call the corresponding method in NSSegmentedCell. The methods of NSSegmentedCell that do not have covers relate to accessing and setting values for tags and tool tips; programatically setting the key segment; and establishing the mode of the control.

The features of a segmented control include:

  • Each segment can have an image, text (label), menu, tooltip, and tag
  • Either the whole control or individual segments can be enabled or disabled
  • There are three tracking modes for segments: select one mode (also known as radio button mode and illustrated by Finder's view mode selection control), momentary mode (as illustrated by Safari's toolbar buttons), or select any mode (where any combination of buttons may be on or off)
  • Each segment can be either a fixed width or autosized to fit the contents
  • If a segment has text and is marked as autosizing, then the text may be truncated so that the control completely fits
  • If an image is too large to fit in a segment, it is clipped
  • Full keyboard control of the user interface
Subclass of the NSControlMBS class.

Feedback, Comments & Corrections

Scaling Modes

Constant Value Description
NSImageScaleAxesIndependently 1 Scale each dimension to exactly fit destination.
This setting does not preserve the aspect ratio of the image.
Available in Mac OS X v10.5 and later.
NSImageScaleNone 2 Do not scale the image.
Available in Mac OS X v10.5 and later.
NSImageScaleProportionallyDown 0 If it is too large for the destination, scale the image down while preserving the aspect ratio.
Available in Mac OS X v10.5 and later.
NSImageScaleProportionallyUpOrDown 3 Scale the image to its maximum possible dimensions while both staying within the destination area and preserving its aspect ratio.
Available in Mac OS X v10.5 and later.

Style Constants

Constant Value Description
NSSegmentStyleAutomatic 0 The appearance of the segmented control is automatically determined based on the type of window in which the control is displayed and the position within the window.
Available in Mac OS X v10.5 and later.
NSSegmentStyleRounded 1 The control is displayed using the rounded style.
Available in Mac OS X v10.5 and later.
NSSegmentStyleRoundRect 2 The control is displayed using the round rect style.
Available in Mac OS X v10.5 and later.
NSSegmentStyleSmallSquare 6 The control is displayed using the small square style.
Available in Mac OS X v10.5 and later.
NSSegmentStyleTexturedSquare 4 The control is displayed using the textured square style.
Available in Mac OS X v10.5 and later.

Constants for the Switch Tracking

Constant Value Description
NSSegmentSwitchTrackingMomentary 2 A segment is selected only when tracking.
NSSegmentSwitchTrackingMomentaryAccelerator 3 accelerator behavior, only selected while tracking.
NSSegmentSwitchTrackingSelectAny 1 Any segment can be selected.
NSSegmentSwitchTrackingSelectOne 0 Only one segment may be selected.

Super class NSControlMBS

Super class NSViewMBS

Window Order Constants

Constant Value Description
NSWindowAbove 1 Moves the window above the indicated window.
NSWindowBelow -1 Moves the window below the indicated window.
NSWindowOut 0 Moves the window off the screen.

Super class NSResponderMBS

This class has no sub classes.

Some methods using this class:

Some examples which use this class:


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


NSSecureTextFieldMBS   -   NSServiceProviderMBS




Links
MBS Xojo Plugins