Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSUserNotificationCenterDelegateMBS class.

NSUserNotificationCenterDelegateMBS.didActivateNotification(center as NSUserNotificationCenterMBS, notification as NSUserNotificationMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event User Notifications MBS MacFrameworks Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No
Sent to the delegate when a user clicks on a user notification presented by the user notification center.
Example
Sub applicationDidFinishLaunching(Notification as NSNotificationMBS)
dim userInfo as Dictionary = Notification.userInfo
dim key as string = NSApplicationMBS.NSApplicationLaunchUserNotificationKey
dim UserNotification as NSUserNotificationMBS = userInfo.Lookup(key, nil)

if UserNotification <> nil then
MsgBox UserNotification.identifier+": "+UserNotification.informativeText
end if
End Sub

center: The user notification center.
notification: The user notification object.

This would be a good time to take action in response to user interacting with a specific notification.

To take an action when your application is launched as a result of a user clicking on a notification, be sure to implement the applicationDidFinishLaunching method in the application class that implements the NSApplicationDelegateMBS class. The notification parameter to that method has a userInfo dictionary, and if that dictionary has the NSApplicationLaunchUserNotificationKey key. The value of that key is the NSUserNotification object that caused the application to launch. The NSUserNotification object is delivered to the NSApplication delegate because that message will be sent before your application has a chance to set a delegate for the NSUserNotificationCenter.

Available in OS X v10.8 and later.

Some examples using this event:

NSUserNotificationCenterDelegateMBS.didDeliverNotification(center as NSUserNotificationCenterMBS, notification as NSUserNotificationMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event User Notifications MBS MacFrameworks Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No
Sent to the delegate when a notification delivery date has arrived.

center: The user notification center.
notification: The user notification object.

This method is always called, regardless of your application state and even if you deliver the user notification yourself using deliverNotification:.

This event is invoked before the shouldPresentNotification event.
Available in OS X v10.8 and later.

Some examples using this event:

NSUserNotificationCenterDelegateMBS.shouldPresentNotification(center as NSUserNotificationCenterMBS, notification as NSUserNotificationMBS) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
event User Notifications MBS MacFrameworks Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No
Sent to the delegate when the user notification center has decided not to present your notification.

center: The user notification center.
notification: The user notification object.

Return true if the user notification should be displayed regardless; false otherwise.
Available in OS X v10.8 and later.

Some examples using this event:

The items on this page are in the following plugins: MBS MacFrameworks Plugin.


The biggest plugin in space...