
Chapter 2: iTool System Architecture 41
iTool Developer’s Guide iTool Messaging System
iTool Messaging System
Notifications are messages sent from one iTool component to one or more observer
components. The iTool messaging system provides a unified way for components to
notify each other of important changes; it is quite general, and can be used to send
messages related to any type of change. Some examples:
• Visualizations send notifications when components of the visualization are
selected or unselected.
• Notifications are issued when the user changes the value of a property. All
visualizations or operations that depend on the value of that property are
automatically notified.
Note
Messaging functionality is provided mainly by the IDLitTool and IDLitUI objects,
using the interface defined by the IDLitIMessaging object.
In many cases, the iTool messaging system is transparent to you as an iTool
developer; you may never need to create code that uses the messaging system. The
main exception to this rule is the creation of user interface panels (discussed in
Chapter 14, “Creating a User Interface Panel”), but there may be other instances in
which the notifications sent by the iTool framework itself do not meet your needs and
must be augmented by your own message generation and handling code.
Sending Notifications
To send a notification, an iTool component calls the IDLitIMessaging::DoOnNotify
method, providing the object identifier of the component that is sending the
notification, a string that uniquely identifies the message being sent, and any value
associated with the message. The method call looks like:
Obj
->DoOnNotify,
IdOriginator
,
IdMessage
,
Value
where Obj is the object calling the DoOnNotify method, IdOriginator is the iTool
component object identifier string of the component that changed, IdMessage is a
string that uniquely identifies the change, and Va l ue is the value associated with
IdMessage.
The DoOnNotify method is available to most iTool components, since all
components subclass from the IDLitIMessaging class either directly or indirectly.
See “IDLitIMessaging::DoOnNotify” (IDL Reference Guide) for details.