System.Messaging.TMessageManager

From Appmethod Libraries
Jump to: navigation, search

System.TObjectTMessageManager

Object Pascal

TMessageManager = class

C++

class PASCALIMPLEMENTATION TMessageManager : public System::TObject

Properties

Type Visibility Source Unit Parent
class public
System.Messaging.pas
System.Messaging.hpp
System.Messaging System.Messaging

Description

Manages message dispatching.

TMessageManager is the class in charge with the application's message handling. It defines an object that acts as an application-wide notification center.

You can create many instances of TMessageManager, but this class can also work as a singleton. You can call TMessageManager.DefaultManager to access an instance of TMessageManager instead of instantiating your own instances and keeping track of them.

Once you have an instance of TMessageManager, you can call TMessageManager.SubscribeToMessage to subscribe message-handling methods to specific types of messages. Message-handling methods may be methods of an object or anonymous methods. After you subscribe a method to a type of message, every time there is a call to TMessageManager.SendMessage with a message of the target type, the subscribed method is called.

To unsubscribe a previously-subscribed method from a message type, call TMessageManager.Unsubscribe.

To broadcast a message to all those methods subscribed to the type of your message in a message manager, create an instance of TMessage or a subclass, and call TMessageManager.SendMessage.

See Also