Watching variables and expressions

The Watch view lets you monitor the values of selected variables and expressions as the application runs.

If the variable or expression is in scope, the Watch view shows its value. Empty quotes indicate that the variable is in scope but has not been initialized. A pair of glasses in the Watch view indicates that the variable or expression is not in scope.

The sample shows the Watch tab page listing several variables and expressions.

Setting variables and expressions in the Watch view

You can select variables you want to watch as the application runs by copying them from a Variables view. You can also set a watch on any PowerScript expression. When you close the debugger, any watch variables and expressions you set are saved.

NoteUsing QuickWatch You can also add variables and expressions to the Watch view from the QuickWatch dialog box. See “QuickWatch”.

StepsTo add a variable to the Watch view:

  1. Select the variable in the Variables view.

  2. Do one of the following:

    • Drag the variable to the Watch view

    • Click the Add Watch button on the PainterBar

    • Select Debug>Add Watch from the menu bar

    PowerBuilder adds the variable to the watch list.

StepsTo add an expression to the Watch view:

  1. Select Insert from the pop-up menu.

  2. Type any valid PowerScript expression in the New Expression dialog box and click OK.

    PowerBuilder adds the expression to the watch list.

StepsTo edit a variable in the Watch view:

  1. Select the variable you want to edit.

  2. Double-click the variable, or select Edit Variable from the pop-up menu.

  3. Type the new value for the variable in the Modify Variable dialog box and click OK.

StepsTo edit an expression in the Watch view:

  1. Select the expression you want to edit.

  2. Double-click the expression, or select Edit Expression from the pop-up menu.

  3. Type the new expression in the Edit Expression dialog box and click OK.

StepsTo clear variables and expressions from the Watch view:

  1. Select the variable or expression you want to delete.

  2. Do one of the following:

    • Select Clear from the pop-up menu

    • Click the Remove Watch button on the PainterBar

    • Select Debug>Remove Watch from the menu bar

StepsTo clear all variables and expressions from the Watch view:

  1. Select Clear All from the pop-up menu