Platforms to show: All Mac Windows Linux Cross-Platform
NSNotificationObserverMBS class
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
class | Notifications | MBS MacBase Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
To use this class, please create a subclass. There you can put code in the event handler to do whatever you need in case your notification is received.
Than you create in code objects form this class. Normally only one. And you call addObserver on the NSNotificationCenterMBS or NSDistributedNotificationCenterMBS objects you have to tell the system which notifications you want to receive.
Do not forget to call removeObserver on the notification center for all your observers to avoid crashes.
- event GotNotification(notification as NSNotificationMBS)
- property Handle as Integer
- 2 methods
- method Constructor
- method Destructor
This class has no sub classes.
Some methods using this class:
- DRNotificationCenterMBS.addObserver(observer as NSNotificationObserverMBS, name as string="", theObject as Variant=nil)
- DRNotificationCenterMBS.removeObserver(observer as NSNotificationObserverMBS, name as string, theObject as Variant=nil)
- NSDistributedNotificationCenterMBS.addObserver(observer as NSNotificationObserverMBS, name as string, theObject as Variant, suspensionBehavior as Integer)
- NSNotificationCenterMBS.addObserver(observer as NSNotificationObserverMBS, name as string="", theObject as Variant=nil)
- NSNotificationCenterMBS.removeObserver(observer as NSNotificationObserverMBS)
- NSNotificationCenterMBS.removeObserver(observer as NSNotificationObserverMBS, name as string, theObject as Variant=nil)
Some examples using this class:
- /AVFoundation/Recorder
- /AVFoundation/Screen Recorder
- /MacBase/Menus/Cocoa Menu Modification
- /MacBase/NSFileHandle async reading
- /MacBase/NSProcessInfo Notifications
- /MacCocoa/Notifications/NSWorkspaceMBS notification receiver
- /MacCocoa/NSUserDefaultsDidChangeNotification Test
- /MacCocoa/readToEndOfFileInBackgroundAndNotify Test
- /MacFrameworks/Blocks test
- /PDFKit/PDFViewControlMBS Test
Blog Entries
- News from the MBS Xojo Plugins Version 24.3
- MonkeyBread Software Releases the MBS Xojo Plugins in version 24.3
- MBS Xojo Plugins, version 24.3pr3
- Tip of the day: Windows Notifications
- MBS Real Studio Plugins, version 12.3pr11
Release notes
- Version 24.3
- Added NSCurrentLocaleDidChangeNotification function for NSLocaleMBS class to use with NSNotificationObserverMBS class.
The items on this page are in the following plugins: MBS MacBase Plugin.
NSNotificationMBS - NSOpenPanelMBS