Platforms to show: All Mac Windows Linux Cross-Platform
NSApplicationDelegateMBS class
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
class | Cocoa | MBS MacCocoa Plugin | 11.2 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Please install in app Constructor as App.Open event may be too late.
Using this class you can get application related events before (!) the app class gets it. And of course more events than just the onces the app class have.
Only for Cocoa desktop targets.
In general the plugin calls first the event. Depending on the result it may pass the event to the Xojo application delegate. If you have no code in the plugin event, everything just passes through and you should not see a difference.
The plugin application delegate is installed with the Constructor and uninstalled in the Destructor.
The original delegate from Xojo is preserved and all messages are forwarded to it. Also when this object is destroyed, the old delegate is restored.
- 34 events
- event applicationDidBecomeActive(Notification as NSNotificationMBS)
- event applicationDidChangeScreenParameters(Notification as NSNotificationMBS)
- event applicationDidDecodeRestorableState(coder as NSCoderMBS)
- event applicationDidFailToRegisterForRemoteNotificationsWithError(error as NSErrorMBS)
- event applicationDidFinishLaunching(Notification as NSNotificationMBS)
- event applicationDidHide(Notification as NSNotificationMBS)
- event applicationDidReceiveRemoteNotification(userInfo as Dictionary)
- event applicationDidRegisterForRemoteNotificationsWithDeviceToken(deviceToken as memoryblock)
- event applicationDidResignActive(Notification as NSNotificationMBS)
- event applicationDidUnhide(Notification as NSNotificationMBS)
- event applicationDidUpdate(Notification as NSNotificationMBS)
- event applicationDockMenu as NSMenuMBS
- event applicationOpenFile(filename as string) as boolean
- event applicationOpenFiles(filenames() as string) as boolean
- event applicationOpenFileWithoutUI(filename as string) as boolean
- event applicationOpenTempFile(filename as string) as boolean
- event applicationOpenUntitledFile as boolean
- event applicationPrintFile(filename as string) as boolean
- event applicationPrintFiles(fileNames() as string, printSettings as dictionary, showPrintPanels as boolean) as boolean
- event applicationShouldHandleReopen(hasVisibleWindows as boolean) as boolean
- event applicationShouldOpenUntitledFile as boolean
- event applicationShouldTerminate as Integer
- event applicationShouldTerminateAfterLastWindowClosed as boolean
- event applicationWillBecomeActive(Notification as NSNotificationMBS)
- event applicationWillEncodeRestorableState(coder as NSCoderMBS)
- event applicationWillFinishLaunching(Notification as NSNotificationMBS)
- event applicationWillHide(Notification as NSNotificationMBS)
- event applicationWillPresentError(error as NSErrorMBS) as NSErrorMBS
- event applicationWillResignActive(Notification as NSNotificationMBS)
- event applicationWillTerminate(Notification as NSNotificationMBS)
- event applicationWillUnhide(Notification as NSNotificationMBS)
- event applicationWillUpdate(Notification as NSNotificationMBS)
- event restoreWindowWithIdentifier(identifier as string, state as NSCoderMBS, byref resultWindow as Variant, byref error as NSErrorMBS) as boolean
- event userDidAcceptCloudKitShareWithMetadata(metadata as Variant)
- 7 constants
Print Reply Constants
Constant | Value | Description |
---|---|---|
NSPrintingCancelled | 0 |
Printing was cancelled. |
NSPrintingFailure | 3 |
Printing failed. |
NSPrintingReplyLater | 2 |
The result of printing cannot be returned immediately, for example, if printing will cause the presentation of a sheet. If your method returns NSPrintingReplyLater it must always invoke replyToOpenOrPrint when the entire print operation has been completed, successfully or not. |
NSPrintingSuccess | 1 |
Printing was successful. |
Terminate Reply Constants
Constant | Value | Description |
---|---|---|
NSTerminateCancel | 0 |
The application should not be terminated. |
NSTerminateLater | 2 |
It may be OK to proceed with termination later. Returning this value causes Cocoa to run the run loop in the NSModalPanelRunLoopMode until your application subsequently calls replyToApplicationShouldTerminate with the value true or false. This return value is for delegates that need to provide document modal alerts (sheets) in order to decide whether to quit. |
NSTerminateNow | 1 |
It is OK to proceed with termination. |
This class has no sub classes.
Some examples using this class:
- /MacCloud/Push Notification/Push Notification
- /MacCloud/Save and restore State
- /MacCocoa/Dock Menu/Dock menu with ApplicationDelegate
- /MacCocoa/Dock Menu/Dock menu with submenu with ApplicationDelegate
- /MacCocoa/Lion Persistence
- /MacCocoa/Save and restore State 2
- /MacFrameworks/User Notification/UserNotification example
Blog Entries
- The order of events in Xojo
- MBS Xojo Plugins, version 21.2pr2
- MBS Xojo / Real Studio Plugins, version 14.3pr9
- MBS Xojo / Real Studio Plugins, version 14.2pr1
- MonkeyBread Software Releases the MBS Real Studio plug-ins in version 11.3
- MBS Real Studio Plugins, version 11.2pr12
- Lion features for Real Studio
- Lion arrived
- MBS Real Studio Plugins, version 11.2pr9
- Dock Menu for Cocoa in Real Studio
Release notes
- Version 21.2
- Added userDidAcceptCloudKitShareWithMetadata event for NSApplicationDelegateMBS class.
The items on this page are in the following plugins: MBS MacCocoa Plugin.
NSAppleScriptMBS - NSApplicationMBS