
Chapter 9: Creating a File Reader 237
iTool Developer’s Guide Creating a New File Reader
(indicating failure), the current Init method also immediately returns with a value of
0:
IF (self->
SomeFileReaderClass
::Init(_EXTRA = _extra) EQ 0) THEN $
RETURN, 0
This convention is used in all file reader classes included with IDL. We strongly
suggest that you include similar checks in your own class definition files.
Keywords to the Init Method
Properties of the file reader class can be set in the Init method by specifying the
property names and values as IDL keyword-value pairs. In addition to any keywords
implemented directly in the Init method of the superclass on which you base your
class, the properties of the IDLitReader class and the IDLitComponent class are
available to any file reader class. See “IDLitReader Properties” and
“IDLitComponent Properties” (IDL Reference Guide).
Note
Always use keyword inheritance (the _EXTRA keyword) to pass keyword
parameters through to the superclass. (See “Keyword Inheritance” (Chapter 5,
Application Programming) for details on IDL’s keyword inheritance mechanism.)
Standard Base Class
While you can create your new file reader class from any existing file reader class, in
many cases, file reader classes you create will be subclassed directly from the base
class IDLitReader:
IF (self->IDLitReader::Init(
Extensions
, _EXTRA = _extra) EQ 0) $
THEN RETURN, 0
where Extensions is a string or array of strings specifying the filename extensions
readable by your file reader.
Note
The value of the Extensions argument is used only to display the proper filename
filter when an Open dialog is displayed — it is not a check for the proper filetype.
The IsA method must check the file to determine whether it is readable by your file
reader.
The IDLitReader class provides the base iTool file reader functionality used in the
tools created by ITT Visual Information Solutions. See “Subclassing from the
IDLitReader Class” on page 234 for details.