Release 10.1A: OpenEdge Development:
ADM and SmartObjects

> ## RUN statement

> Many aspects of SmartObject behavior are invoked by running internal procedures and invoking functions. Much of this behavior is implemented in super procedures that support the SmartObjects. The behavior in super procedures can be localized, and the Progress interpreter will locate and execute the correct behavior. This is possible because super procedures are initialized and added to each SmartObject as each SmartObject starts up.

> For example, an application can use the addLink procedure to add a link from one SmartObject to another during execution:

>     RUN addLink ( hSourceProc, ’navigation’, hTargetProc ).

> In this code, `hSourceProc` is the `HANDLE` of the source procedure and `hTargetProc` is the `HANDLE` of the target procedure.

> The `RUN` statement for `addLink` is written as if `addLink` were an internal procedure within the calling procedure. In fact, it is contained in the super procedure `smart.p`. The super procedure mechanism makes the contents of `smart.p` available to every SmartObject. Standard behavior of this kind includes the following procedures (any many others):

> - `initializeObject`—Runs when each object is started, to initialize that object.

> - `destroyObject`—Runs when an object is terminated, to destroy that object.

> - `addMessage`—Adds an error message to a message log.

> Similarly, the contents of other SmartObject super procedures are available to SmartObjects that require their support. For example, all visible objects use the super procedure `visual.p` and all SmartObjects that can contain other SmartObjects use `containr.p`. (See the AppBuilder online help for a detailed list of super procedures and their contents.) Using this architecture locates the majority of SmartObject behavior in a set of independently built procedures that can serve all SmartObjects that are running in a Progress session. This helps to organize behavior into reusable classes and keeps the size of individual SmartObjects to a minimum.

> Just as a SmartObject can `RUN` procedures implemented in its super procedures, a SmartObject can invoke behavior in another SmartObject simply by knowing its procedure handle and running internal procedures or functions in that SmartObject. For example, one SmartObject can destroy another by executing the following statement:

>     RUN destroyObject IN hOtherObject.

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