Справочник Пользователя для ITT Rule IDL Version 7.0

Скачать
Страница из 430
352
Chapter 15: Creating a Custom iTool Widget Interface
Handling Callbacks
iTool Developer’s Guide
Handling Callbacks
User interface callback routines are executed when an iTool component, for which 
the user interface has created an observer, generates a notification message. The 
callback routine then uses the value of the notification message to determine what 
action to take. Observers are created as described in 
page 342. The iTool messaging system itself is discussed in 
Callback Routine Signature
A user interface widget callback routine has the following signature:
PRO 
WidgetName_callback, Widget, IdOriginator, IdMessage, Value
where:
WidgetName_callback is the name of the callback routine.
Widget is the widget ID of the widget registered as an observer.
IdOriginator is a string identifying the source of the message (usually the 
object identifier of an iTool component object, but it can be any string value).
IdMessage is a string that uniquely identifies the message being sent.
Value is a value that is associated with the message being sent.
See 
 on page 41 for more information on the IdMessage 
and Value arguments.
Registration of Callback Routines
Callback routines are registered along with the user interface itself, in the call to the 
RegisterWidget method of the IDLitUI object. See 
page 342 for details.
Example Callback Routine
The following code segment illustrates a simple callback routine used in both the 
idlitwdtool.pro
 interface and in the example custom interface developed later in 
this chapter. This callback handles only one message, FILENAME, which is 
generated when the user saves the current iTool with a new file name. When the 
callback is executed, the title bar of the iTool interface is updated to reflect the new 
file name.