5.1. Add a Watch Variable to the Program Editor's Watch Variable List

Select Variable Procedure

Guidelines for Variables

Select Variable Procedure

  1. Select a variable in a script.

  2. Do one of the following.

A

Click the Add Watch button on the Application toolbar.

B

Click Debug>Add Watch on the Program Editor menu bar.

C

Press Shift+F9 on the keyboard.

An Add Watch dialog box opens.

  1. Enter specifications as follows.

Field

Description

Variable

Name of the variable you want to add to the watch variable list.

Procedure

Procedure that will be watched.

Script

Script that will be watched.

  1. Click OK or press Enter.

Result: The selected Variable is added to the Add Watch list.

If this is the first variable you are placing on the watch variable list, the watch pane opens far enough to display that variable. If the watch pane was already open, it expands far enough to display the variable you just added.

Guidelines for Variables

The following variables can or cannot be watched.

Cannot watch

Complex variables such as structures or arrays.

Can watch

Variables of fundamental data types.

Examples

Integer

Long

Variant

Individual elements of arrays or structure members using the following syntax:

[variable [(index,...)] [.member [(index,...)]]...]

Where

variable

= Name of the structure or array variable,

index

= Literal number

member

= Name of a structure member.

Example

The following are valid watch expressions:

Watch Variable

Description

a(1)

Element 1 of array a

person.age

Member age of structure person.

company(10,23).person.age

Member age of structure person that is at element 10,23 within the array of structures named company

If you are executing the script, you can

  1. Display the names of all the variables that are in scope or defined within the current function or subroutine on the drop-down Variable Name list.

  2. Select the variable you want from that list.

You can add as many watch variables to the list as you want.

The Watch pane only expands until it fills half of Program Editor's application window. If your list of watch variables becomes longer than that, you can use the watch pane's scroll bars to bring hidden portions of the list into view.

The list of watch variables is maintained between script executions.

More information

5. Use a Watch variable.