Platforms to show: All Mac Windows Linux Cross-Platform

/MacControls/NSSegmentedControl


Required plugins for this example: MBS MacBase Plugin, MBS Main Plugin, MBS MacCocoa Plugin

Last modified Mon, 18th Mar 2012.

You find this example project in your MBS Xojo Plugin download as a Xojo project file within the examples folder: /MacControls/NSSegmentedControl

Download this example: NSSegmentedControl.zip

Project "NSSegmentedControl.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
EventHandler Sub Open() if not TargetCocoa then MsgBox "This example needs Cocoa." quit end if End EventHandler
End Class
Class Window1 Inherits Window
Control SegmentedControl1 Inherits SegmentedControl
ControlInstance SegmentedControl1 Inherits SegmentedControl
End Control
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action() dim n as NSSegmentedControlMBS = SegmentedControl1.NSSegmentedControlMBS n.selectedSegment = 0 End EventHandler
End Control
Control PushButton2 Inherits PushButton
ControlInstance PushButton2 Inherits PushButton
EventHandler Sub Action() dim n as NSSegmentedControlMBS = SegmentedControl1.NSSegmentedControlMBS n.labelForSegment(1) = "Test" End EventHandler
End Control
Control RadioButton1 Inherits RadioButton
ControlInstance RadioButton1 Inherits RadioButton
EventHandler Sub Action() set NSSegmentedControlMBS.NSSegmentStyleAutomatic End EventHandler
End Control
Control RadioButton2 Inherits RadioButton
ControlInstance RadioButton2 Inherits RadioButton
EventHandler Sub Action() set NSSegmentedControlMBS.NSSegmentStyleRounded End EventHandler
End Control
Control RadioButton3 Inherits RadioButton
ControlInstance RadioButton3 Inherits RadioButton
EventHandler Sub Action() set NSSegmentedControlMBS.NSSegmentStyleRoundRect End EventHandler
End Control
Control RadioButton4 Inherits RadioButton
ControlInstance RadioButton4 Inherits RadioButton
EventHandler Sub Action() set NSSegmentedControlMBS.NSSegmentStyleSmallSquare End EventHandler
End Control
Control RadioButton5 Inherits RadioButton
ControlInstance RadioButton5 Inherits RadioButton
EventHandler Sub Action() set NSSegmentedControlMBS.NSSegmentStyleTexturedSquare End EventHandler
End Control
Control BevelButton1 Inherits BevelButton
ControlInstance BevelButton1 Inherits BevelButton
EventHandler Sub Action() dim n as NSSegmentedControlMBS = SegmentedControl1.NSSegmentedControlMBS n.makePreviousSegmentKey End EventHandler
End Control
Control BevelButton2 Inherits BevelButton
ControlInstance BevelButton2 Inherits BevelButton
EventHandler Sub Action() dim n as NSSegmentedControlMBS = SegmentedControl1.NSSegmentedControlMBS n.makeNextSegmentKey End EventHandler
End Control
Sub Set(value as integer) dim n as NSSegmentedControlMBS = SegmentedControl1.NSSegmentedControlMBS n.segmentStyle = value End Sub
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project

See also:

Download this example: NSSegmentedControl.zip

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


The biggest plugin in space...