Platforms to show: All Mac Windows Linux Cross-Platform

Back to NotificationMBS class.

NotificationMBS.RegisterReceiver(target as NotificationReceiverMBS, name as string = "", ref as Variant = nil)

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Notifications MBS DataTypes Plugin 10.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Registers a receiver.

You have a class/window and you add NotificationReceiverMBS to the interfaces. Xojo will add a ReceivedNotification method which looks like this:

ReceivedNotification(name as string, ref as Variant, tag as Variant, notification as NotificationMBS)

Don't forget to call UnregisterReceiver later in the Close event or destructor.

If you register with name = "" and ref = nil, you receive all notifications. If you have a name, you get only notifications matching the name (case sensitive compare). If you have a reference object, you receive only objects for that object. And you can use both name and object.

Some examples using this method:

NotificationMBS.Send(name as string, ref as object = nil, tag as Variant = nil)

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Notifications MBS DataTypes Plugin 10.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Sends a notification.
Example
NotificationMBS.Send("DatabaseChangedNotification")

This is a convenience method which creates a new NSNotificationMBS object and sends it.

All registered receivers will get the ReceivedNotification method called as well as all registered observers will get an ReceivedNotification event.
Of course notifications are filtered by name and/or referenced object.

See also:

NotificationMBS.Send(notification as NotificationMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Notifications MBS DataTypes Plugin 10.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Sends a notification.
Example
dim n as new NotificationMBS("DatabaseChangedNotification")
NotificationMBS.send(n)

All registered receivers will get the ReceivedNotification method called as well as all registered observers will get an ReceivedNotification event.
Of course notifications are filtered by name and/or referenced object.

See also:

NotificationMBS.SendDelayed(name as string, ref as object = nil, tag as Variant = nil)

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Notifications MBS DataTypes Plugin 10.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Sends a notification.
Example
NotificationMBS.SendDelayed("DatabaseChangedNotification")

Same as Send method, but the notification will be delivered later on the main thread. The notification is queued and will wait until there is free CPU time.

See also:

Some examples using this method:

NotificationMBS.SendDelayed(notification as NotificationMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Notifications MBS DataTypes Plugin 10.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Sends a notification.
Example
dim n as new NotificationMBS("DatabaseChangedNotification", window1, "test")
NotificationMBS.SendDelayed(n)

Same as Send method, but the notification will be delivered later on the main thread. The notification is queued and will wait until there is free CPU time.

See also:

NotificationMBS.UnregisterReceiver(target as NotificationReceiverMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Notifications MBS DataTypes Plugin 10.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Unregisters an receiver.

Some examples using this method:

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


The biggest plugin in space...