Registering Components

Registering an object class links the file containing the IDL code that defines the object (an iTool, a visualization type, an operation, etc.) with the object identifier. Objects can be registered either with the iTool system object (in which case their identifiers are fully qualified) or with an individual iTool class (in which case their identifiers are relative to the iTool or to a specific container within the tool).

When an object is registered, it is not immediately instantiated. Instead, the information required to create the object is saved in an object descriptor and placed in the appropriate location in the iTool hierarchy. Later, when the functionality contained in the object is needed, the object descriptor either instantiates the object or provides a reference to an existing instance of the object.

Registration Methods

Objects are registered using the IREGISTER procedure (to register the object with the iTool system object) or by calling a Register method on an individual iTool component object.

Registering Objects with the System Object

Individual iTool components can be registered with the iTool system object. Of these:

To register an object with the iTool system object, use the IREGISTER procedure. See "IREGISTER" (IDL Reference Guide) for details and Registering a New Tool Class for an example using IREGISTER.

Registering Objects with an iTool

Visualization types, operations, manipulators, file readers, and file writers can be registered with an individual iTool. Of these, all must be registered with an individual iTool except for visualization types, which may have been registered with the iTool system object.

Note
Many operations, manipulators, file readers, and file writers are registered by the IDLitToolbase class. If you create a new iTool based on this class, these features will be registered automatically. See Subclassing from the IDLitToolbase Class for details.

Tip
If you want some, but not all, of the functionality exposed by the IDLitToolbase class, you may find it useful to subclass from IDLitToolbase and unregister one or more features. See the sections on unregistering items in the chapters devoted to creating operations, manipulators, file readers, and file writers.

To register an object with an individual iTool, use one of the Register methods of the IDLitTool class. Register methods exist for each type of object that can be registered (IDLitTool::RegisterOperation for operations, for example). A call to a registration method looks something like this

self->RegisterObject, ObjectName, Object_Class_Name 

where Object is one of the object types that can be registered (Visualization, Operation, Manipulator, FileReader, or FileWriter), ObjectName is the string you will use when referring to the object, and Object_Class_Name is a string that specifies the name of the class file that contains the object's definition.

See the Register methods under "IDLitTool" (IDL Reference Guide) for additional details, and Registering a Visualization Type, Registering an Operation, Registering a Manipulator, Registering a File Reader, and Registering a File Writer for examples.

Specifying Object Identifiers

You can use the IDENTIFIER keyword to any of the Register methods to specify an object identifier for the registered object, and thus specify the object's location in the iTool object hierarchy and in the user interface. If you do not specify a value for the IDENTIFIER keyword, a suitable object identifier will be constructed based on the type of object being registered and the specified ObjectName.

Proxy Registration

You can also register an object as a proxy (or alias) to another object that has already been registered. Registering an object as a proxy places the proxy object in the iTool hierarchy in the specified place, but actually calls the original object when a user requests the proxied object. To register a proxy object, specify an object identifier string as the value of the PROXY keyword to the Register method. For example, the following call to the RegisterOperation method places a proxy to the Undo object stored in the iTool hierarchy under OPERATIONS/EDIT/UNDO in the hierarchy under TOOLBAR/EDIT/UNDO:

self->RegisterOperation, 'Undo', PROXY = 'Operations/Edit/Undo', $ 
   IDENTIFIER = 'Toolbar/Edit/Undo'