Progress
AppBuilder
Developer’s Guide
Applying SmartObject Layouts at Run Time
You can reliably affect the layout of a SmartObject at run time in two ways:
Thus, you can set the initial SmartObject layout and change it as often as you like at run time.
Setting the Initial Layout
You can dynamically set the initial layout for your SmartObjects by creating a local createObjects() event procedure in the SmartContainer that parents the SmartObjects:
![]()
The code after the RUN SUPER statement is what you might add to the local createObjects() procedure. This code finds all of the SmartObjects in the SmartContainer (SmartObjects that have Container–Target links to this container). Next, it returns each link handle (the procedure handle for each SmartObject) and sets the ObjectLayout property for the associated SmartObject.
NOTE: Setting a property for a SmartObject that does not recognize the specified property has no effect. In this case, only SmartDataViewers and SmartDataBrowsers respond to the setting of ObjectLayout.The p–layout identifier in this example represents a character-string input parameter to the SmartContainer that holds the initial layout value. This assumes that the SmartContainer is called from some other procedure, perhaps with the actual p–layout value determined at run time.
Note that the initial setting of ObjectLayout occurs after the ADM createObjects() procedure executes. Thus, the SmartContainer changes all the SmartObject instance settings of ObjectLayout after the SmartContainer creates its SmartObjects but before it initializes them (using initializeObject()).
Changing Layouts
You can change the layout of a SmartObject with multiple layouts at any time after initialization. For example, you might do this in a user interface trigger that explicitly changes the layout when the user clicks on a button, or in response to an expression value that determines what layout a particular user is permitted to see (for example, a security key). You might have a series of expressions in a CASE statement that sets a varying layout according to a variety of criteria.
In all of these cases you execute the following code, where so–handle is your SmartObject procedure handle and chosen–layout is the name that you have assigned to the alternate layout to be applied:
Thus, for the Balance button shown in Figure B–8:, you can create a trigger like this:
Executing this code immediately redisplays the layout for the SmartObject specified by the h_v_cust handle. This code can execute anywhere inside or outside of the SmartObject as long as it occurs after SmartObject initialization and while the SmartObject is still instantiated.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |