Tool Palette Actions

Each of the default Visualization tools in the Tool Palette has several associated actions. Each action is a simplified interface to an IDL procedure, which includes positional arguments and keywords.

Actions provide different visualization options for various types of data visualization. Some Visualization tools have many actions, such as Plot. Others have only a few, such as Volume and Vector. The different actions within a visualization type provide different ways to use the corresponding iTools.

In addition to dropping variables on tools, you can drag variables on an action or on individual positional arguments within an action. (See Using Actions.) You can also edit and change the order of system actions and create your own. (See Editing Actions and Creating an Action.) After you create actions, you can share them with your colleagues and use actions that others share with you. (See Exporting Tools and Actions and Importing Tools and Actions.)

Note
Tools do not have to create just visualizations. An action can invoke any IDL procedure. See Creating an Action.

Viewing and Hiding Actions

In the Tool Palette, you have the choice of viewing just the tools or also displaying the corresponding actions. To toggle the view, simply click on the action toggle button (window_icon.gif). (You can also drag the right border of the Tool Palette to the right to display the actions.) For more information on action settings, see Displaying the Tool Actions.

Using Actions

By default, IDL decides which action to use according to the number of data variables that you drop onto a tool. IDL uses the first available action in the list that accepts the number of variables that have been dropped.

Rather than letting IDL decide which action to use, you can drop variables directly on the action of your choice.

Dragging Variables to an Action Example

  1. Make sure you are viewing the IDL Visualize Perspective. (Click the Visualize button (viz_button.gif) in the upper right of the Workbench.)
  2. Click on the action toggle button (window_icon.gif) to expand the Tool Palette to display the actions. (You can also drag the right border of the Tool Palette to the right to display the actions.)
  3. Click on the Plot tool to display the associated Plot actions.icon_plot.gif
  4. Enter the following variables at the command line (or click on the code below to run it in IDL):
  5. x = 2*!PI/100 * FINDGEN(100)
    y = sin(x)

    The variables now appear in the Variables View.

  6. Drag the X variable to the X field of the Line plot:Y vs X action.
  7. Drag the Y variable to the Y field of the same action:
    action_plot_y.gif
  8. Click on IPLOT in the action. The plot displays in an iPlot window:
    action_plot.gif
  9. Note
    If you have already moved or deleted actions that you now want to use, you can restore the default system actions. To do this, select Edit Actions from the Tool Palette menu, click Restore Actions, then click Accept Edits. This does not delete any actions you have created, but places them at the end of the list of system actions.

Editing Actions

IDL allows you to move or delete the default system actions and to create and edit new ones.

Moving and Deleting System Actions

The default actions displayed in the Tool Palette can be moved, deleted, and restored. Keep in mind that when you rearrange or add actions, only your local installation of IDL is affected. These local changes do not affect the look of the Tool Palette in any other installation of IDL.

To move, delete, or edit an action, click on the tool you want to edit (Plot, Image, etc.). Click the pull-down Menu button at the top right of the Tool Palette.

Vis_menu01.jpg

Select Edit Actions.

Tip
You can also use the pop-up context menu accessed from the tool to add a new action or edit an existing one.

context_action02.gif

The action area now appears with the New Action button in the place of the first action and the Cancel Edits and Accept Edits buttons at the top.

edit_action.gif

Click Accept Edits to save your changes or Cancel Edits to undo any changes and return to the Tool Palette.

Creating an Action

The actions provided by the Tool Palette are just a start. You can create your own actions to meet your needs. The system actions are all created using IDL's iTools.

If you want to create actions that perform some data analysis on your visualizations, then Introducing the IDL iTools is a good place to start. To extend the functionality of basic iTools, see Using the iTools Procedural Interface.

But you can use any IDL procedure, even ones you write yourself. You will need to understand some basic IDL programming and know which procedure you want to use. All the IDL routines are listed in the IDL Reference Guide.

Note
Any action can be used to create an overplot, if the IDL procedure you use to create it supports the OVERPLOT keyword. All of the iTools commands support OVERPLOT, but other IDL commands do not.

The following steps describe how to add a new action.

  1. To add the new action, click on the action toggle button (window_icon.gif) to expand the Tool Palette to display the actions. (You can also drag the right border of the Tool Palette to the right to display the actions.)
  2. Click on the tool you want to create (Plot, Image, etc.).
  3. Click the pull-down menu button at the top right of the Tool Palette.
    map_custom_action01.jpg
  4. Select Edit Actions from the pull-down menu, as shown above.
  5. The action area now appears with Cancel Edits and Accept Edits at the top and New Action below that.
    edit_action.gif

    Tip
    You can also use the pop-up context menu accessed from the tool to add a new action or edit an existing one.

    context_action02.gif

  6. Click New Action. The Add New Action dialog appears:
    action_add.gif
  7. Add the items for the new action (red text indicates a required field):
    • IDL procedure—An existing IDL system procedure or one of your own. Use Content Assist (CTRL+Space) to list all the available procedures.
    • Positional Arguments—The name(s) of all the arguments the procedure requires. Each argument must be separated by a comma.
    • Keywords—Optional keywords you want to add to refine the procedure. Use Content Assist (CTRL+Space) to list all the available keywords for the procedure.
      You can use variable tokens such as `%1' with keywords. (See Using Variable Names (Tokens) with Keywords for more information.)
    • Title—The short description or name of the action. This name appears as the first line in the action. Each action must have a unique name.
    • Description—This description appears when you hover the mouse over the action title.

The example below shows the definition for a new image action:

action_edit.gif

  1. Click OK to save the new action.
  2. Click Accept Edits to save your changes or Cancel Edits to undo any changes and return to the Tool Palette.

This action appears in the list of actions bars as:

action_edited.gif

Notice that the hover help appears when you hover over the title or the keywords:

action_hover.gif

Using Variable Names (Tokens) with Keywords

Variable tokens are a way to use variable names in keyword definitions. This functionality is helpful for defining titles in and parameter labels in actions. You can see how variable tokens are used in some of the Plot tool action definitions.

Table 17-3: Tokens in Action Definitions

Token
Description

%0

Represents the name of the command. For example, a surface action with a keyword defined as:

WINDOW_TITLE='%0'

would display a title of ISURFACE when run.

%N

N indicates the index of a positional parameter (variable). For example, an x and y plot could have the following title bar definition:

WINDOW_TITLE='%1 vs. %2'

See the examples below.

%D

Date format: MM/DD/YY

%T

Time format: HH:MM:SS AM/PM

Variables Example

The following example shows you how the variables in an action can be used as tokens for window titles and axis labels.

The following line in the action defines the x and y axis titles, the plot title, and the window title using the two variables in the action.

action_bar_example.jpg

The data for this example is:

plotx=2*!PI/100*FINDGEN(300)
ploty=sin(plotx)

The name of variable x in the variables view is PLOTX and the name of variable y is PLOTY. When these data variables are dropped in the action, the resulting line plot displays.

action_bar_example02.jpg

Troubleshooting Actions

When you create an action, test it right away. If it works differently than you expect, try these options to troubleshoot the functionality:

Resetting the Default Actions

You can reset the actions in the Tool Palette view back to their original settings. Doing this will restore any system actions you have deleted, but will not delete any actions that you have created. Your custom actions will be placed at the end of the list of actions under each tool.

To reset the actions, select Edit Actions from the Tool Palette menu, click Restore Actions, then click Accept Edits. This does not delete any actions you have created.