A SERVICE OF

logo

170 Chapter 7: Creating an Operation
Creating a New Generalized Operation iTool Developer’s Guide
self->RegisterProperty,
PropertyIdentifier
[,
TypeCode] $
[, ATTRIBUTE = value]
where PropertyIdentifier is a string that uniquely identifies the property, TypeCode is
an integer between 0 and 9 specifying the property data type, and ATTRIBUTE is a
property attribute. See “Registering Properties” on page 74 for details.
Setting Property Attributes
If a property has already been registered, perhaps by a superclass of your operation
class, you can change the registered attribute values using the SetPropertyAttribute
method of the IDLitComponent class:
self->SetPropertyAttribute,
Identifier
where Identifier is the name of the keyword to the GetProperty and SetProperty
methods used to retrieve or change the value of this property. (The Identifier is
specified in the call to RegisterProperty either via the PropertyName argument or the
IDENTIFIER keyword.) See “Property Attributes” on page 78 for additional details.
Example Init Method
The following example code shows a very simple Init method for an operation named
ExampleOp. This function would be included (along with the class structure
definition routine and any other methods defined by the class) in a file named
exampleop__define.pro.
FUNCTION ExampleOp::Init, _REF_EXTRA = _extra
; Initialize the superclass.
IF (self->IDLitOperation::Init(TYPES=['IDLARRAY2D'], $
NAME='Example Operation', ICON='generic_op', $
_EXTRA = _extra) NE 1) THEN $
RETURN, 0
; Unhide the SHOW_EXECUTION_UI property.
self->SetPropertyAttribute, 'SHOW_EXECUTION_UI', HIDE=0
; Return success
RETURN, 1
END
Discussion
The
ExampleOp class is based on the IDLitOperation class (discussed in
“Subclassing from the IDLitOperation Class” on page 166). As a result, all of the
standard features of an iTool operation are already present. We don’t define any