Add breakpoints in application scripts

Note

Now you open the Debugger and add breakpoints to examine the behavior of the login and Customer windows. When PowerBuilder runs the application in debug mode, it stops just before executing a line containing a breakpoint.

When you insert breakpoints in a script, you should select lines that contain executable statements. If you try to set a breakpoint in variable-declaration lines, comment lines, or blank lines, PowerBuilder sets the breakpoint at the next executable line.

Debug button
  1. Click the Debug button in the PowerBar.

    PowerBuilder opens the Debugger. There are three stacks of tabbed panes in the default view layout scheme. The Source view is visible in a single pane at the top left of the Debug window. The Source Browser view is open in the pane at the top right.

    Shown is the default view layout scheme of the Debug window.

    The source code for the application Open event displays in the Source view at top left. If it does not display, expand the Application node in the Source Browser view’s tree view and double-click the Open event under the pbtutor application.

  2. In the Source view, double-click the line containing the following assignment statement:

    this.ToolBarSheetTitle = "MDI Application Toolbar"
    

    A black breakpoint symbol displays at the start of the line to show that a breakpoint has been set on the statement.

    Shown is the Source view.
  3. Expand the following node in the Source Browser view: Windows>w_welcome>cb_ok

    The Source Browser view lists only events that have been coded. The only event for the login window OK button is the Clicked event.

  4. Double-click the Clicked event for the cb_ok button in the Source Browser view.

    The code for the Clicked event displays in the Source view.

  5. Double-click the following line:

    gnv_connect = CREATE & 
    
    			n_pbtutor_connectservice
    

    A breakpoint symbol displays at the start of the line.

    Shown is the Source view.
  6. Double-click w_master_detail_ancestor in the Source Browser view.

    Double-click dw_master, then rowfocuschanged.

    PowerBuilder displays the script for the RowFocusChanged event of the dw_master DataWindow control in the Source view.

  7. Double-click this line:

    IF dw_detail.Retrieve(ll_itemnum) = -1 THEN
    

    A breakpoint symbol displays at the start of the line.

  8. Select the Breakpoints tab in the lower-right stack.  

    Shown is the Debugger window. The Breakpoints tab lists p b tutor dot open dot eight, w welcome c b o k clicked four, and w master detail ancestor d w master row focus changed three.

    You should see the breakpoints you set in the Breakpoints view. To complete this lesson, you need to have these breakpoints set correctly.