Managing Script Watch Expressions using the Watch List Panel in Altium NEXUS
Parent page: Working with Panels
Summary
The Watch List panel enables you to create and display a list of watch expressions, allowing you to keep track of variable/expression values as you single-step debug the current script document.
Panel Access
From the Scripting Editor, the panel can be accessed in the following ways:
- Click View » Panels » Watch List
- Click the button at the bottom-right of the workspace and select the Watch List option.
Content and Use
The panel lists, for each watch that is added, the Expression (what to watch for) and the Value (the evaluation of the expression at the current line in the script).
As you step through the lines of code in the script document, the watch expressions will be evaluated and the corresponding values updated if the script changes any of the variables used in those expressions.
When script execution enters a function or procedure a watch expression will only be valid if the variable(s) in the expression are defined and used in that function or procedure. If a variable is not available to the function or procedure (i.e. is not global or is local to another part of the script) then the Value field will display Undeclared identifier: VariableName.
Right-click Menu
The right-click pop-up menu for the panel provides the following commands:
- Edit Watch - use this command to access the Watch Properties, from where you can edit the expression for the selected watch as required
- Add Watch - use this command to access the Add New Watch dialog, from where you can define a new watch to add to the list of watches in the panel.
Simply define the required expression that you wish to monitor. For example, the expression could be a particular variable that is used in the code (e.g. OUT, a, Remainder), or an expression based on one or more defined variables (e.g. OUT=OUT+Remainder). Clicking OK will add the new watch to the panel, at the bottom of the list
- Delete Watch - delete the selected watch
- Delete All Watches - delete all currently defined watches listed in the panel.
Notes
- The value of an expression is updated after the line of code has been executed
- The keyboard shortcuts Up Arrow (or Left Arrow), Home, End and Down Arrow (or Right Arrow), can be used to select the previous, first, last and next watch entry, respectively
- The Expression field in the Add New Watch dialog supports standard text editing features such as cut, copy and paste. The latter enables you to copy a variable name directly from the script document and paste it into the dialog
- The Add New Watch dialog can also be accessed using the Add Watch command, available from the Run menu
- The Watch Properties dialog can also be accessed by double-clicking on an entry in the panel
- You can change the order in which the two columns are displayed. To move a column, click on its header and drag it horizontally to the required position. A valid position is indicated by the appearance of two green positional arrows.