user manual
Chapter 10: Creating a File Writer 269
iTool Developer’s Guide Registering a File Writer
Registering a File Writer
Before a file writer can be used by an iTool to write a file, the file writer’s class
definition must be registered as being available to the iTool. Registering a file writer
with the iTool links the class definition file that contains the actual IDL code that
defines the file writer with a simple string that names the writer. Code that calls a file
writer in an iTool uses the name string to specify which writer should be created.
Using IDLitTool::RegisterFileWriter
In most cases, you will register a file writer with the iTool in the iTool’s class Init
method. Registration ensures that the file writer is available when the iTool attempts
to use it to write a file. (See “Creating a New iTool Class” on page 91 for details on
the iTool class Init method.)
To register a file writer, call the IDLitTool::RegisterFileWriter method:
self->RegisterFileWriter,
Writer_Type
,
WriterType_Class_Name
, $
ICON =
icon
where Writer_Type is the string you will use when referring to the file writer,
WriterType_Class_Name is a string that specifies the name of the class file that
contains the file writer’s definition, and icon is a string containing the name of a
bitmap file to be used in the preferences browser.
Note
The file
WriterType_Class_Name
__define.pro must exist somewhere in
IDL’s path for the file writer to be successfully registered.
See “IDLitTool::RegisterFileWriter” (IDL Reference Guide) for details.
Specifying Useful Properties
You can set any property of the IDLitWriter and IDLitComponent classes when
registering a file writer. The following properties may be of particular interest:
ICON
Set this property to a string value giving the name of an icon to be associated with
this object. Typically, this property is the name of a bitmap file to be used when
displaying the object in a tree view. See “Icon Bitmaps” on page 44 for details on
where bitmap icon files are located.