A SERVICE OF

logo

Chapter 9: Creating a File Reader 245
iTool Developer’s Guide Registering a File Reader
Registering a File Reader
Before a file reader can be used by an iTool to read in a file, the file reader’s class
definition must be registered as being available to the iTool. Registering a file reader
with the iTool links the class definition file that contains the actual IDL code that
defines the file reader with a simple string that names the reader. Code that calls a file
reader in an iTool uses the name string to specify which reader should be created.
Using IDLitTool::RegisterFileReader
In most cases, you will register a file reader with the iTool in the iTool’s class Init
method. Registration ensures that the file reader is available when the iTool attempts
to use it to read a file. (See “Creating a New iTool Class” on page 91 for details on the
iTool class Init method.)
To register a file reader, call the IDLitTool::RegisterFileReader method:
self->RegisterFileReader,
Reader_Type
,
ReaderType_Class_Name
, $
ICON =
icon
where Reader_Type is the string you will use when referring to the file reader,
ReaderType_Class_Name is a string that specifies the name of the class file that
contains the file reader’s definition, and icon is a string containing the name of a
bitmap file to be used in the preferences browser.
Note
The file
ReaderType_Class_Name
__define.pro must exist somewhere in
IDL’s path for the file reader to be successfully registered.
See “IDLitTool::RegisterFileReader” (IDL Reference Guide) for details.
Specifying Useful Properties
You can set any property of the IDLitReader and IDLitComponent classes when
registering a file reader. The following properties may be of particular interest:
ICON
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.