Platforms to show: All Mac Windows Linux Cross-Platform
Required plugins for this example: MBS MacFrameworks Plugin, MBS MacBase Plugin, MBS MacCocoa Plugin, MBS MacControls Plugin, MBS Main Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCocoa/LevelIndicator
This example is the version from Fri, 26th Apr 2012.
Project "LevelIndicator.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control CocoaControlMBS1 Inherits CocoaControlMBS
ControlInstance CocoaControlMBS1 Inherits CocoaControlMBS
EventHandler Function GetView() As NSViewMBS
n1=new NSLevelIndicatorMBS(0,0,me.Width,me.Height)
n1.maxValue = 100
n1.minValue = 0
n1.DoubleValue = 50
n1.levelIndicatorStyle = n1.NSRelevancyLevelIndicatorStyle
n1.warningValue = 40
n1.criticalValue = 20
n1.tickMarkPosition = n1.NSTickMarkBelow
n1.numberOfMajorTickMarks = 5
n1.numberOfTickMarks = 10
Return n1
End EventHandler
End Control
Control Slider1 Inherits Slider
ControlInstance Slider1 Inherits Slider
EventHandler Sub ValueChanged()
n1.DoubleValue = me.Value
End EventHandler
End Control
Control CocoaControlMBS2 Inherits CocoaControlMBS
ControlInstance CocoaControlMBS2 Inherits CocoaControlMBS
EventHandler Function GetView() As NSViewMBS
n2=new NSLevelIndicatorMBS(0,0,me.Width,me.Height)
n2.maxValue = 100
n2.minValue = 0
n2.DoubleValue = 50
n2.levelIndicatorStyle = n2.NSContinuousCapacityLevelIndicatorStyle
n2.warningValue = 40
n2.criticalValue = 20
n2.tickMarkPosition = n2.NSTickMarkAbove
n2.numberOfMajorTickMarks = 5
n2.numberOfTickMarks = 10
Return n2
End EventHandler
End Control
Control Slider2 Inherits Slider
ControlInstance Slider2 Inherits Slider
EventHandler Sub ValueChanged()
n2.DoubleValue = me.Value
End EventHandler
End Control
Control Slider3 Inherits Slider
ControlInstance Slider3 Inherits Slider
EventHandler Sub ValueChanged()
n3.DoubleValue = me.Value
End EventHandler
End Control
Control CocoaControlMBS3 Inherits CocoaControlMBS
ControlInstance CocoaControlMBS3 Inherits CocoaControlMBS
EventHandler Function GetView() As NSViewMBS
n3=new NSLevelIndicatorMBS(0,0,me.Width,me.Height)
n3.maxValue = 100
n3.minValue = 0
n3.DoubleValue = 50
n3.levelIndicatorStyle = n3.NSDiscreteCapacityLevelIndicatorStyle
n3.warningValue = 40
n3.criticalValue = 20
Return n3
End EventHandler
End Control
Control CocoaControlMBS4 Inherits CocoaControlMBS
ControlInstance CocoaControlMBS4 Inherits CocoaControlMBS
EventHandler Function GetView() As NSViewMBS
n4=new NSLevelIndicatorMBS(0,0,me.Width,me.Height)
n4.maxValue = 5
n4.minValue = 0
n4.DoubleValue = 2
n4.levelIndicatorStyle = n4.NSRatingLevelIndicatorStyle
Return n4
End EventHandler
End Control
Control Slider4 Inherits Slider
ControlInstance Slider4 Inherits Slider
EventHandler Sub ValueChanged()
n4.DoubleValue = me.Value
End EventHandler
End Control
Control CocoaControlMBS5 Inherits CocoaControlMBS
ControlInstance CocoaControlMBS5 Inherits CocoaControlMBS
EventHandler Function GetView() As NSViewMBS
n5=new NSLevelIndicatorMBS(0,0,me.Width,me.Height)
n5.maxValue = 100
n5.minValue = 0
n5.DoubleValue = 50
n5.levelIndicatorStyle = n1.NSRelevancyLevelIndicatorStyle
n5.warningValue = 40
n5.criticalValue = 20
Return n5
End EventHandler
End Control
Control Slider5 Inherits Slider
ControlInstance Slider5 Inherits Slider
EventHandler Sub ValueChanged()
n5.DoubleValue = me.Value
End EventHandler
End Control
Control CocoaControlMBS6 Inherits CocoaControlMBS
ControlInstance CocoaControlMBS6 Inherits CocoaControlMBS
EventHandler Function GetView() As NSViewMBS
n6=new NSLevelIndicatorMBS(0,0,me.Width,me.Height)
n6.maxValue = 100
n6.minValue = 0
n6.DoubleValue = 50
n6.levelIndicatorStyle = n6.NSContinuousCapacityLevelIndicatorStyle
n6.warningValue = 40
n6.criticalValue = 20
Return n6
End EventHandler
End Control
Control Slider6 Inherits Slider
ControlInstance Slider6 Inherits Slider
EventHandler Sub ValueChanged()
n6.DoubleValue = me.Value
End EventHandler
End Control
Control Label1 Inherits Label
ControlInstance Label1 Inherits Label
End Control
EventHandler Sub Open()
if not CocoaControlMBS1.Available then
MsgBox "This example requires Mac OS X 10.5."
quit
end if
End EventHandler
Property n1 As NSLevelIndicatorMBS
Property n2 As NSLevelIndicatorMBS
Property n3 As NSLevelIndicatorMBS
Property n4 As NSLevelIndicatorMBS
Property n5 As NSLevelIndicatorMBS
Property n6 As NSLevelIndicatorMBS
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
The items on this page are in the following plugins: MBS MacCocoa Plugin.