Platforms to show: All Mac Windows Linux Cross-Platform
/MacCocoa/NSUserDefaultsDidChangeNotification Test
Required plugins for this example: MBS MacBase Plugin, MBS Main Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCocoa/NSUserDefaultsDidChangeNotification Test
This example is the version from Sun, 5th Apr 2014.
Project "NSUserDefaultsDidChangeNotification Test.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
EventHandler Sub Open()
n = NSNotificationCenterMBS.defaultCenter
o = new MyObserver
n.addObserver o, NSUserDefaultsMBS.NSUserDefaultsDidChangeNotification
End EventHandler
Property n As NSNotificationCenterMBS
Property o As MyObserver
End Class
Class MainWindow Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
Control BevelButton1 Inherits BevelButton
ControlInstance BevelButton1 Inherits BevelButton
EventHandler Sub Action()
dim u as NSUserDefaultsMBS = NSUserDefaultsMBS.standardUserDefaults
u.setStringValue "test", "Hello World"
End EventHandler
End Control
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
Class MyObserver Inherits NSNotificationObserverMBS
EventHandler Sub GotNotification(notification as NSNotificationMBS)
dim l as listbox = MainWindow.List
l.AddRow "Got notification: "+notification.name
End EventHandler
End Class
End Project
The items on this page are in the following plugins: MBS MacCocoa Plugin.