Progress
AppBuilder
Developer’s Guide


Modifying SmartObject Layouts

You can modify and synchronize SmartObject layouts in the design window similar to basic procedure file layouts. (For more information, see the "Modifying Layouts–Layout Inheritance" section.) However, SmartObject instances in a SmartContainer layout have additional features.

To illustrate working with SmartObject layouts, the rest of this section references a SmartDialog that contains a SmartDataViewer that has three layouts: a master and two alternates. The master layout, shown in Figure B–4, contains many of the fields of the sports database Customer table, some of which overlay each other.

Figure B–4: SmartDataViewer Master Layout

Each of the alternate layouts, shown in Figure B–5 and Figure B–6, displays or hides different sets of the fields in the master layout.

Figure B–5: SmartDataViewer Address Alternate Layout

Figure B–6: SmartDataViewer Balance Alternate Layout

In general, SmartObjects instances inherit the active layout of the parent SmartContainer in the AppBuilder. While the SmartContainer is in an alternate layout, you cannot set the ObjectLayout (or any other instance property) of the SmartObjects that it contains. To set the active layout of a SmartObject instance, the parent SmartContainer must be in the master layout. Also, once set, the layout for a SmartObject instance overrides any subsequent layout setting inherited from the parent SmartContainer. If you want the SmartContainer to change the layout of its SmartObjects dynamically, you can create an override createObjects() event procedure that sets the ObjectLayout properties of the SmartObjects after they are created.

Setting Layout Options for SmartObject Instances

Several SmartObjects provided with Progress include instance properties dialog boxes that allow you to set run-time options for a SmartObject instance. For more information, see the "SmartObject Properties" section in "Frequently Used Dialogs." You can set instance properties only for a SmartObject displayed in the master layout of the parent SmartContainer, in the example, a SmartDialog.

You can access the Properties dialog box for an instance in two ways. One is to click on the instance menu button to display the pop-up menu shown in Figure B–7.

Figure B–7: SmartDataViewer Menu Button’s Pop-up Menu

This allows you to go directly to the Instance Properties dialog box by clicking on Instance Properties. Alternatively, you can click on Properties (or double-click on the instance itself) to open the Instance property sheet, then click on the Edit button to open the Instance Properties dialog box.

For the same SmartObject instance with the parent SmartContainer displayed in an alternate layout, the menu button’s pop-up menu changes to prevent you from modifying any instance properties, as shown in Figure B–8.

Figure B–8: Menu Button’s Pop-up Menu in Alternate Layout

In this case, the Instance Properties option is insensitive and the Delete Instance option is replaced with the Remove from Layout option. Both Remove from Layout and Delete Instance hide the SmartObject from view. However, Remove from Layout only hides the SmartObject, while Delete Instance actually deletes it from the SmartContainer. Remove from Layout is used for alternate layouts rather than Delete Instance because the SmartObject instance is still available from the master layout of the SmartContainer.

Also, the Instance property sheet changes in a SmartContainer alternate layout, as shown in Figure B–9.

Figure B–9: Instance Property Sheet in Alternate Layout

This is the property sheet for the SmartDataViewer instance in an alternate layout. Note that the Edit button is insensitive, preventing editing of the instance properties. The Remove from Layout option, the Layout inherited from the SmartContainer, and the Sync with Master button are also added to the property sheet. The Parameterize as Variable option, normally available in the master layout, is also insensitive.

This example illustrates how you might have an alternate layout standard for the windows and dialog boxes of an entire application, while maintaining the ability to apply instance-specific layouts (Layout = Balance Information) for SmartObjects contained within these windows and dialog boxes. Thus, you might have two or more application visualizations in which the SmartObject instances retain the same functional layouts.

Two supported SmartObjects, SmartDataViewers and SmartDataBrowsers, support ObjectLayout as an instance property. You can set this property in the Instance Properties dialog box using the Layout combo box, as shown in Figure B–10.

NOTE: If the SmartObject has no alternate layouts, the Layout combo box is insensitive

.

Figure B–10: SmartDataViewer Properties with Layout Options

You get this particular Instance Properties dialog box for the SmartDataViewer instance shown in Figure B–7, displayed in the SmartContainer master layout.

In general, the Layout combo box lists the LayoutOptions property values available for the SmartObject instance. These are the alternate layout names that you define for the SmartObject when you create or edit the SmartObject in the AppBuilder using the Alternate Layout dialog box (Figure B–3). If the SmartObject has a visualization for an alternate layout (such as Balance Information), you can make it visible for the instance by selecting the Layout value. Once you select and confirm the layout (by clicking on OK), the visualization for the selected layout appears in the SmartContainer design window for that SmartObject instance (Figure B–8). Note the difference in the SmartDataViewer instance layout between Figure B–7and Figure B–8.

Regardless of which layout you set for the SmartContainer, the SmartObject instance always displays the selected layout, as indicated by the ObjectLayout instance property setting shown in Figure B–9. This is true at run time as well as at design time, unless you explicitly create a run-time override of the instance layout. For more information on run-time layout overrides, see the "Applying SmartObject Layouts at Run Time" section.

If you leave the instance layout setting as [default], the instance in the design window has no layout property setting and displays the SmartObject master layout or the current layout of the SmartContainer, if different. This setting also allows you to specify the initial layout for the instance by the run-time setting of the DefaultLayout property.


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