Required plugins for this example: MBS MacBase Plugin, MBS MacFrameworks Plugin, MBS Main Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacExtras/NSAppearance Test
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control CurrentLabel Inherits Label
ControlInstance CurrentLabel Inherits Label
End Control
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action()
dim t as string = NSAppearanceMBS.NSAppearanceNameVibrantDark
dim a as NSAppearanceMBS = NSAppearanceMBS.appearanceNamed(t)
if a = nil then
MsgBox "No Appearance with that name?"
else
NSAppearanceMBS.setCurrentAppearance a
NSAppearanceMBS.setAppearance(self, a) // apply to window
end if
update
End EventHandler
End Control
Control Label1 Inherits Label
ControlInstance Label1 Inherits Label
End Control
Control CheckBox1 Inherits CheckBox
ControlInstance CheckBox1 Inherits CheckBox
End Control
Control RadioButton1 Inherits RadioButton
ControlInstance RadioButton1 Inherits RadioButton
End Control
Control TextField1 Inherits TextField
ControlInstance TextField1 Inherits TextField
End Control
Control Slider1 Inherits Slider
ControlInstance Slider1 Inherits Slider
End Control
EventHandler Sub Open()
update
End EventHandler
Sub Update()
dim a as NSAppearanceMBS = NSAppearanceMBS.currentAppearance
CurrentLabel.Text = "Current Appearance is: "+a.name
End Sub
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar