Detailed Instructions
Task 2: Coding Common Menu Items
1. Re-open m_master in the menus.pbl.
2. All coding steps in this task will have you code the default event, Clicked, of the menu items.
3. Script the FileÆSave item, generically calling the attached window’s ue_save event. Use the dot notation syntax you learned in Module 4 for firing events. You have two options here; you can make a DYNAMIC call or a STATIC call (preferred). Two options you have are shown below:
DYNAMIC: ParentWindow.EVENT DYNAMIC ue_save( ) OR:
STATIC:
w_sheet lw_sheet lw_sheet = ParentWindow
lw_sheet.EVENT ue_save( )
4. Repeating the above step, code the FileÆPrint item to call ue_print( ). 5. Script the FileÆExit menu item as follows:
Close(ParentWindow)
12. Open w_child and/or w_response. Can you associate m_sheet with these windows? Why or why not?
_____________________________________________________________________ 13. When associating menus to windows it will not be necessary to write any code to
instantiate the menu. The window does it for you.
14. Using the System Tree, right-click over w_sheet and select Edit Source from the context menu.
15. In the Class Definition, look for the section named on w_sheet.create. You should see that menus associated as we have are automatically instantiated (created) behind the scenes by PowerBuilder. PowerBuilder also automatically destroys the menu (see the on w_sheet.destroy section).
16. Also, while we are here, remember in the lab for Module 4, you placed shell events into w_sheet named: ue_delete, ue_insert, ue_save and ue_print. The fact that those shells have already been created has bearing on upcoming tasks.
17. Close the Source editor (Class Definition).
Task 2: Coding Common Menu Items
1. Re-open m_master in the menus.pbl.
2. All coding steps in this task will have you code the default event, Clicked, of the menu items.
3. Script the FileÆSave item, generically calling the attached window’s ue_save event. Use the dot notation syntax you learned in Module 4 for firing events. You have two options here; you can make a DYNAMIC call or a STATIC call (preferred). Two options you have are shown below:
DYNAMIC: ParentWindow.EVENT DYNAMIC ue_save( ) OR:
STATIC:
w_sheet lw_sheet lw_sheet = ParentWindow
lw_sheet.EVENT ue_save( )
4. Repeating the above step, code the FileÆPrint item to call ue_print( ). 5. Script the FileÆExit menu item as follows:
6. Code WindowÆTile Vertical as follows: ParentWindow.ArrangeSheets(tile!)
7. Using WinHelp, look up the appropriate enumerated type to the ArrangeSheets( ) function and code the remaining items under Window except for Close All. 8. Save your work.
9. Code the HelpÆSybHealth Help menu item. You will not be creating a HELP file for this application, instead, you will just have this item open the PowerBuilder help system. In this item’s script, call the ShowHelp( ) PowerScript function. Look at WinHelp for an example of how to use this function. The name of the PowerBuilder help file is PBHLP120.hlp and is in the Student folder.
10. Code HelpÆAbout… to open w_about created in the lab for Module 5. 11. Save your work.
12. Re-script the Save menu item.
13. Copy the code you put in the Save item to the Windows Clipboard.
14. Close the painter. There are reasons we always have you close painters. First, they are a resource drain on the IDE. If you don’t need them open, close them. Second, you cannot have an ancestor and descendant objects opened at the same time. PowerBuilder does not allow that.
15. Open m_sheet.
16. Script the ToolsÆInsert item by pasting from your clipboard and then changing the event name to ue_insert( ). Pass a value of 1 to the argument of this event. 17. Script ToolsÆDelete the same as above firing ue_delete( ). Pass a value of 1 to the
argument of this event.
18. Script ToolsÆToolbars… to open the w_toolbars window you imported in the last lab. Use the following code:
OpenWithParm(w_toolbars, parentwindow)
(OpenWithParm( ) will be explained in the next module.) 19. Save your work.
20. Close the painter.
21. More menu items will be coded as you build more components of the SybHealth system.
6. Code WindowÆTile Vertical as follows: ParentWindow.ArrangeSheets(tile!)
7. Using WinHelp, look up the appropriate enumerated type to the ArrangeSheets( ) function and code the remaining items under Window except for Close All. 8. Save your work.
9. Code the HelpÆSybHealth Help menu item. You will not be creating a HELP file for this application, instead, you will just have this item open the PowerBuilder help system. In this item’s script, call the ShowHelp( ) PowerScript function. Look at WinHelp for an example of how to use this function. The name of the PowerBuilder help file is PBHLP120.hlp and is in the Student folder.
10. Code HelpÆAbout… to open w_about created in the lab for Module 5. 11. Save your work.
12. Re-script the Save menu item.
13. Copy the code you put in the Save item to the Windows Clipboard.
14. Close the painter. There are reasons we always have you close painters. First, they are a resource drain on the IDE. If you don’t need them open, close them. Second, you cannot have an ancestor and descendant objects opened at the same time. PowerBuilder does not allow that.
15. Open m_sheet.
16. Script the ToolsÆInsert item by pasting from your clipboard and then changing the event name to ue_insert( ). Pass a value of 1 to the argument of this event. 17. Script ToolsÆDelete the same as above firing ue_delete( ). Pass a value of 1 to the
argument of this event.
18. Script ToolsÆToolbars… to open the w_toolbars window you imported in the last lab. Use the following code:
OpenWithParm(w_toolbars, parentwindow)
(OpenWithParm( ) will be explained in the next module.) 19. Save your work.
20. Close the painter.
21. More menu items will be coded as you build more components of the SybHealth system.