
Appendix A: Controlling iTools from the IDL Command Line 391
iTool Developer’s Guide Running Operations
Running Operations
Use the DoAction method of the IDLitTool class to execute an operation on the
currently selected item in the currently selected iTool. For example, suppose you
have created an iPlot tool with the following command:
IPLOT, RANDOMU(seed, 15)
To call the Median operation on the plot line, you could use the following statements:
idTool = ITGETCURRENT(TOOL=oTool)
idMedian = oTool->FindIdentifiers('*median*', /OPERATIONS)
success = oTool->DoAction(idMedian)
The Median operation would be applied. If the SHOW_EXECUTION_UI property
for the operation is set to True, the operation’s dialog appears before the operation is
executed. See “Note on the SHOW_EXECUTION_UI Property” on page 391.
Warning
This example relies on the fact that the plot is selected after the iTool is created; see
“Selecting Items in the iTool” on page 393 for details on how to set the selection
explicitly.
You can insert one or more calls to the DoSetProperty method (as described in
“Changing Property Values” on page 389) before the call to the DoAction method.
For example, to change the Width property used by the Median operation to 9, and set
the Even Average property to True you could do the following:
idTool = ITGETCURRENT(TOOL=oTool)
idMedian = oTool->FindIdentifiers('*median*', /OPERATIONS)
success = oTool->DoSetProperty(idMedian, 'WIDTH', 9)
success = oTool->DoSetProperty(idMedian, 'EVEN', 1)
success = oTool->DoAction(idMedian)
In this example both property changes and the application of the Median operation
are entered into the undo-redo buffer as a single item.
Note on the SHOW_EXECUTION_UI Property
Every iTool operation included with the standard iTools that has a visible user
interface has a registered property named SHOW_EXECUTION_UI. Setting this
property to 1 (True) will cause the operation’s graphical user interface to be displayed
before the operation is executed, giving the user the option to change any parameters
the operation may have. If the property is set to 0 (False), the operation will execute
without displaying the graphical user interface.