Detailed Instructions
Task 4: Creating Standard Visual User Objects
1. View the contents of visual_controls_base and visual_controls_abstract.pbls using the System Tree.
2. What does the prefix of u_ stand for?
_____________________________________________________________________ 3. SVUO stands for?
_____________________________________________________________________ 4. We provided some SVUOs in the mini-framework to save time and allow us to teach
you more concepts. We have already created User Object versions of common Window controls like SingleLineEdit (u_sle), Radio Button (u_rb), CommandButton (u_cb), etc.
5. You are going to create your own DataWindow control.
6. Right-click over the SybHealth_target in the System Tree and select New… from the context menu.
7. On the PB Object tab, select Standard Visual and then click OK. 8. Select DataWindow (control) on the Select dialog. Click OK.
12. Close w_data_sheet.
13. Verify existence of the four events on w_master_detail_sheet. You have reduced the amount of effort necessary by half because of inheritance. Remember, code will be added later, as we learn new concepts and techniques.
14. Before closing the Window painter, select Tools-Keyboard Shortcuts… from the menu and then add the following shortcuts:
15. EditÆGo ToÆ Events – Ctrl+Shift+E 16. EditÆGo ToÆ Functions – Ctrl+Shift+F 17. EditÆGo ToÆ Instance Variables – Ctrl+Shift+I 18. EditÆActivate AutoScript – Ctrl+Tab
19. You will want to commit to memory some of the default shortcuts under Additional Painter Shortcuts. While you will not immediately understand their use, as we start into modules where coding is involved, you will use these many times. Good shortcuts to remember are:
a. Control Drop-down – Ctrl+1 b. Script Drop-down – Ctrl+2 c. Show/Hide Prototype – Ctrl+4 20. Close any open painters.
Task 4: Creating Standard Visual User Objects
1. View the contents of visual_controls_base and visual_controls_abstract.pbls using the System Tree.
2. What does the prefix of u_ stand for?
_____________________________________________________________________ 3. SVUO stands for?
_____________________________________________________________________ 4. We provided some SVUOs in the mini-framework to save time and allow us to teach
you more concepts. We have already created User Object versions of common Window controls like SingleLineEdit (u_sle), Radio Button (u_rb), CommandButton (u_cb), etc.
5. You are going to create your own DataWindow control.
6. Right-click over the SybHealth_target in the System Tree and select New… from the context menu.
7. On the PB Object tab, select Standard Visual and then click OK. 8. Select DataWindow (control) on the Select dialog. Click OK.
9. You have just inherited from the PowerBuilder System Class DataWindow control, as the title bar of the User Object painter indicates.
10. Enable the HScrollBar and VScrollBar properties of the DataWindow control. 11. On the Other property tab, set the Width to 2000 and Height to 1000.
12. Navigate to the Declare Instance Variables tab where we will add some custom properties:
Boolean ib_single_select Boolean ib_multi_select
13. Save your DataWindow control as u_dw in the visual_controls_base.pbl. 14. Now that you have a DataWindow control, re-open w_data_sheet.
15. Drag the u_dw from the System Tree on top of the w_data_sheet (on the Layout). Resize the DataWindow so that it occupies the majority of the window. In the Properties view, name the DataWindow control dw_data.
16. Save your work and close the painter. 17. Re-open w_master_detail_sheet.
18. Set the window’s width to 3500 and height to 2000.
9. You have just inherited from the PowerBuilder System Class DataWindow control, as the title bar of the User Object painter indicates.
10. Enable the HScrollBar and VScrollBar properties of the DataWindow control. 11. On the Other property tab, set the Width to 2000 and Height to 1000.
12. Navigate to the Declare Instance Variables tab where we will add some custom properties:
Boolean ib_single_select Boolean ib_multi_select
13. Save your DataWindow control as u_dw in the visual_controls_base.pbl. 14. Now that you have a DataWindow control, re-open w_data_sheet.
15. Drag the u_dw from the System Tree on top of the w_data_sheet (on the Layout). Resize the DataWindow so that it occupies the majority of the window. In the Properties view, name the DataWindow control dw_data.
16. Save your work and close the painter. 17. Re-open w_master_detail_sheet.
19. Drag two u_dw’s on top of w_master_detail_sheet in a top-to-bottom fashion. Name the top DataWindow dw_master and the bottom dw_detail. Resize your DataWindow controls as appropriate. Your window should look like the following:
20. While one of the DataWindow controls has focus, check the Properties view, General tab (scroll to the bottom) and you should see your two custom properties,
ib_single_select and ib_multi_select. 21. Save your work and close the painter.
22. Allowing the user to choose where the toolbars display is a common feature. We have created the window already. All you have to do is import it.
23. In the System Tree, right-click over the sybhealth.pbl and select Import… 24. Navigate to the \Student folder and select w_toolbars.srw.
25. Click OK.
26. Open w_toolbars to see what functionality it contains. 27. Close any open painters.
19. Drag two u_dw’s on top of w_master_detail_sheet in a top-to-bottom fashion. Name the top DataWindow dw_master and the bottom dw_detail. Resize your DataWindow controls as appropriate. Your window should look like the following:
20. While one of the DataWindow controls has focus, check the Properties view, General tab (scroll to the bottom) and you should see your two custom properties,
ib_single_select and ib_multi_select. 21. Save your work and close the painter.
22. Allowing the user to choose where the toolbars display is a common feature. We have created the window already. All you have to do is import it.
23. In the System Tree, right-click over the sybhealth.pbl and select Import… 24. Navigate to the \Student folder and select w_toolbars.srw.
25. Click OK.
26. Open w_toolbars to see what functionality it contains. 27. Close any open painters.