ITT Rule IDL Version 7.0 Bedienungsanleitung Seite 164

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 430
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 163
164 Chapter 7: Creating an Operation
Creating a New Data-Centric Operation iTool Developer’s Guide
Creating an UndoExecute Method
The operation class’ UndoExecute method is called when the user undoes an
invocation of the operation and the REVERSIBLE_OPERATION property is set on
the operation object. (See “Operations and the Undo/Redo System” on page 150 for
details on how undo and redo are handled in different situations.) The UndoExecute
method must reverse the effect of the Execute method.
The actual processing performed by the UndoExecute method depends entirely on
the operation.
Example UndoExecute Method
The following example code shows a simple UndoExecute method for the
ExampleDataOp operation, which reverses the operation of the Execute method.
FUNCTION ExampleDataOp::UndoExecute, data
; If byte data then offsets are 0 and 255, otherwise
; use data minimum and maximum.
offsetMax = (SIZE(data, /TYPE) eq 1) ? 255b : MAX(data)
offsetMin = (SIZE(data, /TYPE) eq 1) ? 0b : MIN(data)
data = offsetMax - TEMPORARY(data) + offsetMin
RETURN, 1
END
Discussion
When the user undoes an invocation of our ExampleDataOp operation, the iTool
system supplies the data that were computed by the Execute method when the
operation was invoked. Our UndoExecute method then reverses the original
operation.
Seitenansicht 163
1 2 ... 159 160 161 162 163 164 165 166 167 168 169 ... 429 430

Kommentare zu diesen Handbüchern

Keine Kommentare