Debugging Screens

Scripting is not supported by TWC

The Canvas debugger allows you to observe the runtime behavior of your script and locate logic errors. With the debugger, you can break execution to step through your code and evaluate variables in your application. The debugger works with all Canvas programming languages.

On the Canvas toolbar, click Debug selected screen then Debug selected screen to open two screens:

Sample debug screen

Sample debug screen

Debug Toolbar

The Canvas Debug dialog box toolbar contains the following buttons, which correspond to the associated shortcut.

Icon Command Option Description Keyboard Shortcut

Start debugging

Start debugging

Run / debug the script. The screen preview dialog box becomes active.

F5

Stop debugging

Stop debugging

Terminate the debug process.

Shift+F5

Step over

Step over

Execute a single instruction in the script. If the instruction is a function call, the whole function is executed. See To step over a function call for more information.

F10

Step into

Step into

Execute a single instruction in the script. If the instruction is a function call, the debugger steps into the function. See To step into a function call for more information.

F11

Debug Panes

The Canvas Debug dialog box contains several panes that allow you to debug and interact with your script.

Debug Panes Description

Call Stack

The Call Stack pane displays call stack information, that is, the function or procedure calls that are currently on the stack. The pane shows the order in which methods and functions are getting called. The call stack is a good way to examine and understand the execution flow of your script.

Breakpoints

The Breakpoints pane displays a list of the active breakpoints in your script. See To set a function breakpoint for more information.

Locals

The Locals pane displays local variable values while in debug mode in the script editor. Local variables are those that are defined in the local scope, which is generally the function or method that is currently being executed and you can step through variables and watch them change.

Watch

The Watch pane is available to watch and evaluate variables and expressions while you are debugging. See To add a watch expression for more information.

To set a function breakpoint

You can set breakpoints when you want to stop debugger execution, to see the state of code variables or to look at the call stack.

To step into a function call

Use the Step into command to execute code one statement at a time. Step into enters break mode at the current line of execution. If the statement is a call to a procedure, the next statement displayed is the first statement in the procedure. If there is no current execution point, the Step into command may appear to do nothing until you do something that triggers code, for example click on a document.

To step over a function call

This command is like Step into. The difference in use occurs when the current statement contains a call to a procedure. Step over executes the procedure as a unit, and then steps to the next statement in the current procedure. Therefore, the next statement displayed is the next statement in the current procedure regardless of whether the current statement is a call to another procedure. Available in break mode only.

To add a watch expression

Sample watch expression

Sample watch expression