Create
a new sheet window inheritance hierarchy
The new window you create now is an extension layer between the
basesheet window and application sheet windows. Later in this lesson you
make changes to the extension layer window. The changes you make are
automatically extended to any new sheet windows that you inherit from the
extension layer window.
In the current tutorial application, the w_customers and w_products
windows already inherit from the w_pbtutor_basesheet window. Because you
have not yet added any non-generic property values or functions to these
sheet windows (other than their names and display text), you can write
over these wizard-generated windows without having to transfer any code to
the replacement windows. In this lesson you overwrite these windows with
new windows that inherit from the extension layer window.
-
Select File>Inherit from the PowerBuilder menu.
The Inherit from Object dialog box displays.
-
Make sure that pbtutor.pbl is selected in the Libraries list box
and that Windows is selected in the Objects Of Type drop-down
list.If you cannot see the full library list, you can change the size
of the dialog box by clicking on one of its edges and holding down the
mouse button while you drag the edge toward a corner of the screen.
The pbtutor.pbl should be the first of two libraries listed in the
Libraries list box. -
Select w_pbtutor_basesheet in the Object column of the main list
box and click OK. -
Select File>Save As, and in the Save Window dialog box,
select w_master_detail_ancestor in the Windows field for the new
window name. -
(Optional) Type the following text in the Comments box:
1New ancestor basesheet for the w_customers and w_products sheet windows. -
Make sure that pbtutor.pbl is selected in the Application
Libraries list box and click OK.Select File>Close to close the new ancestor basesheet.
You cannot create descendant windows if an ancestor window is
open in the Window painter. -
Select File>Inherit from the PowerBuilder menu.
-
Make sure that pbtutor.pbl is selected in the Libraries list box
and that Windows is selected in the Objects Of Type drop-down list
box.Select w_master_detail_ancestor and click OK.
-
Type Maintain Customers in the Tag text box on the General page
of the Properties view.Select File>Save As from the PowerBuilder menu and select
w_customers in the Windows list box. -
Change the Comments text to:
1Customer sheet window inheriting from w_master_detail_ancestor. -
Click OK, then click Yes in the Save Window message box that
asks if you want to replace the existing w_customers window.The new sheet window inherits from w_master_detail_ancestor
instead of from w_pbtutor_basesheet. -
Repeat steps 7-11, with the following modifications:
Step
Modified instruction
9
Type Maintain Products in the Tag text box on the
General page of the Properties view. Select File>Save As
from the PowerBuilder menu and select w_products in the
Windows list box.10
Change the Comments text to: Product sheet window
inheriting from w_master_detail_ancestor.11
The message box prompts you to replace the
existing w_products window. -
Close the new w_customers and w_products windows.
You cannot open an ancestor window in the Window painter if any
of its descendants are already displayed in the painter. -
From the PowerBuilder menu, select Run>Full Build
Workspace.You should rebuild the workspace after changing the inheritance
hierarchy and before making modifications to the new ancestor window.
You can see the status of the build in the Output window, which
displays below the System Tree at the bottom of the PowerBuilder main
window. The build is finished when the Output window displays Finished
Full build of workspace MyWorkspace. -
Close the Output window.