Release 10.1A: OpenEdge Development:
Progress Dynamics Advanced Development

> ## Setting up your test window

> To illustrate the toolbar’s ability to control objects on multiple pages, you must create several pages in the window for the toolbar to control, including:

> - Toolbar and folder on Page 0

> - Customer objects on Page 1

> - Customer maintenance viewer on Page 2

> - Order maintenance objects on Page 3

> - Defining the Foreign Fields property for a child SDO

> - OrderLine maintenance objects on Page 4

> - Modifying the resize attributes of a browser

> - Summary of all the links for the window

> ##### Toolbar and folder on Page 0

> The first step is to add the basic toolbar and folder on Page 0.

> | To add the toolbar and folder:

> 1. Use the `FolderPageTop` toolbar, which has Update and Navigation buttons and also a standard File menu. There are in fact a variety of different built-in toolbars that you can investigate using the Toolbar and Menu Designer, or you can build a new one of your own.

> 2. Add an instance of the dynamic folder object, called `afspfoldw.w`. When you add the folder to the window in the Container Builder, the tool creates a `Page` link automatically from the folder to the window itself, since this is required for the folder to function properly.

> 3. In the Container Builder, choose the Page Maintenance tool, as shown:

> 4. In the Page Maintenance window, add four folder tabs with the labels Customer, Maint, Order s, and OrderLine records, as shown:

> ##### Customer objects on Page 1

> The next step is to put customer information on Page 1.

> | To add `Customer` objects on Page 1 of the window:

> 1. Add a `Customer` SDO, such as the `customerfullo` dynamic SDO that the Object Generator created for you.

> 2. Add a dynamic `Customer` browser such as the `customerfullb` that the Object Generator created, where the user can select a `Customer` record to work with. There is also a viewer under the browser to display a selection of fields that might be helpful. You can build this dynamic viewer in the AppBuilder, selecting just the fields you want to see. In the example this viewer is called `custcommentsv`, since it features the Customer Comments field.

> 3. Add the following links:

> - A `Navigation` link from the toolbar to the `Customer` SDO on Page 1.
> - A `Data` link from the SDO to the browser on Page 1.
> - A `Data` link from the SDO to the viewer on Page 1. The viewer is just for data display purposes, so there is no `TableIO` link to it and no `Update` link back to the SDO.

> At this point, the window, which comes up with Page 0 and Page 1 displayed, should look like this:

> Note the state of the toolbar buttons. The Next and Last Navigation buttons are enabled to show that the query is now positioned on the first record of the dataset. The Update buttons are all disabled because there is no object on the page that can do an update (and no `TableIO` link to communicate those `Update` events through).

> ##### Customer maintenance viewer on Page 2

> The next step is to create an editable maintenance viewer on Page 2.

> | To add a Customer maintenance viewer:

> 1. Add another `Customer` viewer to Page 2. For `Customer` maintenance, start with the dynamic `customerviewv,` created by the Object Generator, open it, and rearrange the fields.

> 2. Add the following links:

> - A `Data` link from the `Customer` SDO to this viewer.
> - A `TableIO link` from the toolbar to the viewer.
> - An `Update` link from the viewer to the SDO, so that users can add and maintain `Customers` using the viewer.

> Page 2 of the window looks like this:

> Note that because the viewer is a `TableIO-Target` for the toolbar and an `Update-Source` for the SDO, the appropriate Update buttons in the toolbar are enabled.

> ##### Order maintenance objects on Page 3

> Page 3 of the window is for viewing and editing `Orders`.

> | To add `Order` maintenance objects:

> 1. In the Container Builder, place the `Order` SDO `orderfullo`, the dynamic browser `orderfullb`, and the dynamic viewer `orderviewv` onto Page 3.

> 2. Edit the viewer in the AppBuilder to arrange the fields more appealingly.

> 3. Add the following links:

> - A `Data` link from the `Customer` SDO on Page 1 to the `Order` SDO on Page 3.
> - A `Data` link from the `Order` SDO to the `Order` browser.
> - A `Data` link from the `Order` SDO to the `Order` viewer.
> 4. To enable the toolbar support for this page, define the following links:

> - A `TableIO` link from the toolbar to the `Order` viewer.
> - An `Update` link from the `Order` viewer to the `Order` SDO.
> - A `Navigation` link from the toolbar to the `Order` SDO.

> ##### Defining the Foreign Fields property for a child SDO

> When you create a `Data` link from `Customer` to `Order`, you must set the `ForeignFields` property of the `Order` SDO to identify which key is passed into the `Order` SDO to qualify its query.

> | To define the ForeignFields property:

> 1. Select the Order SDO in the Container Builder.

> 2. To the immediate right of the Foreign Fields editor, click the button to bring up the Foreign Fields Mapping dialog box. This dialog box allows you to quickly map sources and targets.

> 3. Map `Order.Custnum` to `Custnum.` This tells the framework that the `Order` query must be modified at run time to insert the phrase `Order.CustNum = <CustNum>`, where `<CustNum>` represents the current value of the CustNum field in the parent `Customer` SDO, as shown:

> 4. Page 3 of your window should look like this:

> ##### OrderLine maintenance objects on Page 4

> Page 4 is the `OrderLine` page.

> | To define `OrderLine` maintenance objects:

> 1. Place the `OrderLine` SDO orderlinfullo, the `OrderLine` browser orderlinfullb, and the `OrderLine` viewer orderlinviewv on this page.

> 2. Edit the viewer in the AppBuilder to rearrange the fields.

> 3. Define these links:

> - A `Data` link from the `Order` SDO to the `OrderLine` SDO.
> - A `Data` link from the `OrderLine` SDO to the `OrderLine` browser.
> - A `Data` link from the `OrderLine` SDO to the `OrderLine` viewer.
> - A `TableIO` link from the toolbar to the viewer.
> - An `Update` link from the viewer to the SDO.
> - A `Navigation` link from the toolbar to the `OrderLine` SDO.
> 4. Set the OrderLine SDO’s ForeignFields to OrderLine.OrderNum,OrderNum.

> ##### Modifying the resize attributes of a browser

> Page 4 is sized to fit the overall size of the largest page when you run the window. Because there are typically only a few `OrderLine` records per `Order`, the browser might be taller than it needs to be, since by default it is sized to take up all available space on the page after the viewer, which is a fixed size, has been placed at the bottom.

> | To change this layout behavior:

> 1. Make sure that the Resize Vertical toggle box is off in the Container Builder for the `OrderLine` browser. This leaves it at its initial size regardless of the overall size of the folder, as shown:

> 2. Set the MinHeight attribute in the dynamic property sheet to change the initial height, as shown:

> Note: You can also modify the MinWidth and ResizeHorizontal attributes. You can set the ResizeHorizontal attribute to `FALSE` and set the `MinWidth` of the browser in order to fix its width in the window so it is always the right size to display its fields.

> With the changes to MinHeight and ResizeVertical, Page 4 looks like this:

> ##### Summary of all the links for the window

> The Container Builder’s Link Editor displays a summary of all the links you should have when you have completed these tasks, as shown:

Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095