Variables View

The Variables view displays the values of variables in the current execution scope. Used in conjunction with the Debug view, the Variables view allows you to see the values of variables in the routine in which execution halted. If the calling context changes during execution—as when stepping into a procedure or function—the variable list changes to reflect the current context.

variables_view_window1.gif

Note
You can also see the value of a variable by hovering the mouse pointer over an instance of the variable name in an editor window that shows the routine in which execution halted.

To add the Variables view to the current perspective, click Window  Show View  Variables.

View Display

The Variables view displays the following types of variables:

Icon
Variable Type
Description

local_variable_icon.gif

Local
(Scalar)

A local variable is active in the current program scope. For example, a variable defined in procedure A is local while that procedure is executing. When control passes to the caller of the procedure, the variable is no longer local.

local_variable_array_icon.gif

Local
(Array)

common_block_variable_icon.gif

Common Block

Variables in a common block have a global scope within procedures defining the same common block. The name of each common block is shown in parentheses next to the variable contained within it.

system_variable_icon.gif

System

System variables are a special class of predefined variables available to all program units.

structure_icon.gif

Structure

A structure is a collection of scalars, arrays, or other structures contained in a variable.

The Variables view can display the following variable attributes:

Variable Attribute
Description

Name

This field shows the name of the variable. This field is read-only, except for array subscript descriptions.

For compound variables such as arrays, structures, pointers, and objects, click the "+" symbol to the left of the name to show the variables included in the compound variable. Click the "-" symbol to collapse the description.

Value

This field shows the value of the variable.

Type

This field shows the data type of the variable.

Details Pane

The Variables view has an optional Details pane that displays extended information. Selecting a variable name row in the view displays the variable value (or array values) in the Details pane.

The Details pane is displayed by default. To hide the Details pane, on the Variables view toolbar select Menu  Layout  Variables View Only.

To display the Details pane, on the Variables view toolbar select Menu  Layout  Vertical View Orientation or Menu  Layout  Horizontal View Orientation.

The following screen shot shows the Variables view in the horizontal view orientation:

variables_view_window2.jpg

If a selected variable is not an array, the Details pane merely displays the variable value (identical to that listed in the Value column). For array variables, the Details pane displays the element values. The displayed element range of each dimension is defined by the Print Dimensions row (which is by default collapsed underneath the array row).

For example, in a three-dimensional array of ten elements per dimension, the default behavior is to display the top slice of the matrix. The Value column of the Print Dimensions row represents this as:

[0:9,0:9,0:0] 

In this notation, the displayed elements of a dimension are delimited by a colon, and dimensions are separated by commas. In this example, elements 0-9 are displayed for the first two dimensions, and element zero is displayed for the third dimension.

You could change the element ranges to display the entire array:

[0:9,0:9,0:9] 

Or, you could display the third slice of the matrix:

[0:9,0:9,2:2] 

In this way, you can specify exactly which elements of an array to display.

Changing a Variable Value

You can change scalar values only. You may alter structure fields, but only if the field value is a scalar type. You may not alter pointer or object reference values.

To edit a variable in the Value column:

  1. In the Value column, select the variable value.
  2. Enter the new value.
  3. Press Return.

To edit a variable using the Change Value... menu item:

  1. Select a row in the Variables view.
  2. Select Change Value... from the view menu.
  3. Enter the new value in the Set Value dialog.
  4. Click OK.

To edit a variable in the Details pane:

  1. Select and change a value in the Details pane.
  2. Type Ctrl-S to assign the new value to the variable, or right-click on the new value and select Assign Value from the context menu.

Deleting Variables

You can delete variables from IDL's $MAIN$ scope. (Variables in the program scope of a running routine cannot be deleted.)

To delete variables:

  1. Select one or more rows in the Variables view.
  2. Click on the Delete Variable icon in the view toolbar (a red X), or select Delete Variable... from the view menu.

Renaming a Variable

You can rename variables in IDL's $MAIN$ scope. (Variables in the program scope of a running routine cannot be renamed.)

To rename a variable:

  1. Select a single row in the Variables view.
  2. Select Rename Variable from the view menu. The variable's name is highlighted in the Variables view itself.
  3. Change the variable name.
  4. Press Return.

Toolbar

The toolbar of the Variables view contains the following buttons:

variables_view_buttons.jpg

Toolbar Button
Description

Collapse All

Collapses the tree expansion state of all variables in the view.

Delete Variable

Deletes the currently selected variable.

Menu

Displays menu items that allow you to:

  • Choose whether to display the Details pane.
  • If the Details pane is displayed, arrange the panes in a row or column.
  • Choose to display more than one column of variable attributes, and select which columns to display.
  • Delete a variable
  • Rename a variable
  • Change a variable's value

Minimize

Minimizes the view in the perspective.

Maximize

Maximizes the view in the perspective.