ITT Rule IDL Version 7.0 User Manual

Page of 430
Appendix A: Controlling iTools from the IDL Command Line
393
iTool Developer’s Guide
Selecting Items in the iTool
Selecting Items in the iTool
When you execute an operation in an iTool, the operation will be applied to the 
currently selected item. You can use the Select method of the IDLitVisualization 
class to ensure that the correct item is selected.
To select an item, do the following:
1. Find the object’s full identifier as described in 
 on page 382. Note that only visualizations and annotations can be 
selected.
2. Get an object reference to the object using the GetByIdentifier method of the 
IDLitContainer class.
3. Call the Select method.
Example: Selecting an Item Programmatically
For example, suppose you create an iPlot tool with two plot lines, using the following 
statements:
IPLOT, RANDOMU(seed, 15)*FINDGEN(15)
IPLOT, FINDGEN(15), /OVERPLOT
After these statements have been executed, the second (straight) plot line will be 
selected in the tool. To select the first plot line, you would use the following 
statements:
idTool = ITGETCURRENT(TOOL=oTool)
plotIDs = oTool->FindIdentifiers('*plot*', /VISUALIZATIONS)
plotObj0 = oTool->GetByIdentifier(plotIDs[0])
plotObj0->Select
To apply the smooth operation to the first plot line (which has now been 
programmatically selected), setting the value of the SHOW_EXECUTION_UI 
property to 0 (False), you would use the following statements:
idSmooth = oTool->FindIdentifiers('*smooth', /OPERATIONS)
success = oTool->DoSetProperty(idSmooth, 'SHOW_EXECUTION_UI', 0)
success = oTool->DoAction(idSmooth)