Consultor Eletrônico



Kbase P92023: How invoke functionality from one smart object to another
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   19/08/2004
Status: Unverified

GOAL:

How invoke functionality from one smart object to another

GOAL:

RUN Protocol in smartDataObject

GOAL:

RUN Protocol in ADM2

FACT(s) (Environment):

Progress 9.x

FIX:

All SmartObjects can invoke the behavior of other SmartObjects in themselves by running internal procedures and invoking functions and by publishing events to which other objects subscribe.

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 that are 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.