Справочник Пользователя для ITT Rule IDL Version 7.0

Скачать
Страница из 430
Chapter 7: Creating an Operation
179
iTool Developer’s Guide
Creating a New Generalized Operation
Note
The UndoOperation method could also have been implemented without the use of 
the values stored in the command set object simply by decrementing the value of 
the STYLE property for each target. 
Creating a RedoOperation Method
The operation class RedoOperation method is called when the user redoes the 
operation by selecting “Redo” from a menu or toolbar.
Example RedoOperation Method
The following example code shows a very simple RedoOperation method for the 
ExampleOp
 operation:
FUNCTION ExampleOp::RedoOperation, oCommandSet
; Retrieve the IDLitCommand objects stored in the
; command set object.
oCmds = oCommandSet->Get(/ALL, COUNT = nObjs)
; Get a reference to the iTool object.
oTool = self->GetTool()
; Loop through the IDLitCommand objects and restore the
; new values.
FOR i = 0, nObjs-1 DO BEGIN
oCmds[i]->GetProperty, TARGET_IDENTIFIER = idTarget
oTarget = oTool->GetByIdentifier(idTarget)
; Get the new value
IF (oCmds[i]->GetItem('NEW_STYLE', styleIndex) EQ 1) THEN $
oTarget->SetProperty, STYLE = styleIndex
ENDFOR
RETURN, 1
END
Discussion
The RedoOperation method does the following things:
1. Retrieves an array of IDLitCommand objects from the supplied 
IDLitCommandSet object
2. Gets a reference to the iTool object.