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:
- Find the object's full identifier as described in Retrieving Component Identifiers. Note that only visualizations and annotations can be selected.
- Get an object reference to the object using the GetByIdentifier method of the IDLitContainer class.
- 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:
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 = IGETCURRENT(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)