Detailed Instructions
Task 6: Debugging an Application
1. This task has you using the PowerBuilder Debugger. We will use the claim calculator to learn how to use this utility.
2. To debug, you will need to run the application in its entirety, which you are not yet set up to do.
3. Re-open the a_sybhealth Application object. 4. Navigate to the Open event.
5. Code the Open event to open the w_claim_calculator window: Open(w_claim_calculator)
6. Close and save your Application object.
7. Click on the Run menu item on PowerBuilder’s menu bar.
8. On the drop down menu, you will see two options: Debug sybhealth_target and Select and Debug. Your current workspace has two targets. If you needed to debug a target other than SybHealth_target, you would have to use the Select and Debug option. Select and Debug displays a dialog letting you select which target you wish to debug. There are also icons on the PowerBar to accomplish the same task.
9. Click the Debug sybhealth_target option on the Run menu. 10. The Debugger opens.
11. In the upper-right of the Debugger is a view named the Source Browser. It has a tree view containing the generic PowerBuilder object types. Expand Windows.
10. Save and Run/Preview… the claim calculator window to test your work. You may need to resize the window to see more information in the title bar.
11. Close any open painters when you have completed your testing.
Task 6: Debugging an Application
1. This task has you using the PowerBuilder Debugger. We will use the claim calculator to learn how to use this utility.
2. To debug, you will need to run the application in its entirety, which you are not yet set up to do.
3. Re-open the a_sybhealth Application object. 4. Navigate to the Open event.
5. Code the Open event to open the w_claim_calculator window: Open(w_claim_calculator)
6. Close and save your Application object.
7. Click on the Run menu item on PowerBuilder’s menu bar.
8. On the drop down menu, you will see two options: Debug sybhealth_target and Select and Debug. Your current workspace has two targets. If you needed to debug a target other than SybHealth_target, you would have to use the Select and Debug option. Select and Debug displays a dialog letting you select which target you wish to debug. There are also icons on the PowerBar to accomplish the same task.
9. Click the Debug sybhealth_target option on the Run menu. 10. The Debugger opens.
11. In the upper-right of the Debugger is a view named the Source Browser. It has a tree view containing the generic PowerBuilder object types. Expand Windows.
12. Expand w_claim_calculator. 13. Expand cb_test.
14. The Source Browser only shows events that have been coded, simplifying the setup of the Debugger. Double-click on the clicked( ) event of cb_test.
15. The Clicked event code is now displaying in the upper right view of the Debugger. You are now ready to set a breakpoint. You can set as many breakpoints as you need, but for this exercise, keep things simple.
16. Double-click on the statement where you are getting the data from the em_amount EditMask. Double clicking will result in a red dot being placed to the left of the code. This is a breakpoint. When you come into the debugger, you should have some idea of where the application is breaking and set breakpoints accordingly.
17. On the menu, click DebugÆStart sybhealth_target, or click the first icon on the PainterBar.
18. The window will appear to be running as normal until you hit a breakpoint. 19. Enter a claim amount of 100.00 and a type of HSPTL. Click the Calculate button.
The window disappears and you are back in the Debugger.
12. Expand w_claim_calculator. 13. Expand cb_test.
14. The Source Browser only shows events that have been coded, simplifying the setup of the Debugger. Double-click on the clicked( ) event of cb_test.
15. The Clicked event code is now displaying in the upper right view of the Debugger. You are now ready to set a breakpoint. You can set as many breakpoints as you need, but for this exercise, keep things simple.
16. Double-click on the statement where you are getting the data from the em_amount EditMask. Double clicking will result in a red dot being placed to the left of the code. This is a breakpoint. When you come into the debugger, you should have some idea of where the application is breaking and set breakpoints accordingly.
17. On the menu, click DebugÆStart sybhealth_target, or click the first icon on the PainterBar.
18. The window will appear to be running as normal until you hit a breakpoint. 19. Enter a claim amount of 100.00 and a type of HSPTL. Click the Calculate button.
20. You will see a yellow arrow over the breakpoint indicator (red dot). Code execution has been suspended, awaiting your input.
21. If not selected, click the Local tab (middle of Debugger), where you will see the values of any declared local variables.
22. Press the F8 (Step) key one time. The yellow arrow moves to the next statement and the value of the ldb_claim_amt local variable has been updated.
23. Double-click the ldb_claim_amt variable in the Debugger. A dialog opens, allowing you to change the value. Change the value to 200 and click OK.
24. Press the F8 two times.
20. You will see a yellow arrow over the breakpoint indicator (red dot). Code execution has been suspended, awaiting your input.
21. If not selected, click the Local tab (middle of Debugger), where you will see the values of any declared local variables.
22. Press the F8 (Step) key one time. The yellow arrow moves to the next statement and the value of the ldb_claim_amt local variable has been updated.
23. Double-click the ldb_claim_amt variable in the Debugger. A dialog opens, allowing you to change the value. Change the value to 200 and click OK.
25. When in the Debugger, it is always helpful to watch the title bars. In the upper-left view (where the code displays), you should now see that you have entered the code for your of_calculate( ) function you wrote earlier.
26. You can continue to F8 to step thru code until you have found what you are looking for in the Debugger. You could also choose to Step Out (Shift-F8) the of_calculate( ) function if you don’t need to walk the code there. There is also a Step Over (F10) that you could use to have totally avoided the function altogether.
27. Spend a few minutes exploring the Debugger. You may have to start and stop the Debugger to explore fully.
28. When done, close the Debugger.
25. When in the Debugger, it is always helpful to watch the title bars. In the upper-left view (where the code displays), you should now see that you have entered the code for your of_calculate( ) function you wrote earlier.
26. You can continue to F8 to step thru code until you have found what you are looking for in the Debugger. You could also choose to Step Out (Shift-F8) the of_calculate( ) function if you don’t need to walk the code there. There is also a Step Over (F10) that you could use to have totally avoided the function altogether.
27. Spend a few minutes exploring the Debugger. You may have to start and stop the Debugger to explore fully.