Progress
ADM 2 Guide


Invoking Behavior in Other Linked Objects

A SmartObject can execute internal procedures or functions in any SmartObject to which it is linked. This is often necessary to access special behavior or to facilitate communication between the SmartObjects. Accessing these internal procedures or functions does not require the SmartObjects to know each others’ procedure handles.

The ADM accomplishes this using the Progress PUBLISH/SUBSCRIBE syntax. Each SmartLink represents a set of named events. During the creation of a SmartLink, its Source automatically subscribes to the named events in the Target procedure, and vice versa. For example, the Navigation–Target subscribes to the named events fetchFirst, fetchNext, fetchPrev, and fetchLast in a SmartPanel Navigation–Source. When the application runs and a user presses the Next button, the SmartPanel executes the following statement, which sends a message to its Navigation–Target:

PUBLISH ’fetchNext’. 

This syntax does not require the SmartPanel to keep track of which objects are its Navigation–Targets. Instead, the Progress interpreter tracks this using the SUBSCRIBE statements that the addLink procedure executes on the Navigation–Target’s behalf. (The addLink procedure is executed when the SmartObjects are initialized.)

The standard ADM code contains many such PUBLISH statements. Custom application code can also use PUBLISH statements such as these to communicate between SmartObjects. For example, suppose that you use the addLink procedure as follows to add a SmartLink that is not recognized as one of the object’s supported links:

RUN addLink(h1, ’newLink’, h2) 

The addLink procedure now executes the following statement:

SUBSCRIBE PROCEDURE h2 TO ’newlink’ IN h1. 

The procedure h1 can now execute the PUBLISH statement whenever it wants to invoke the named event in h2:

PUBLISH ’newlink’. 

Each SmartObject includes properties for each link type. These properties, which have names composed of the link type followed by an event name, define the events to which an object is automatically subscribed by the addLink procedure. (See Table 3–2 through Table 3–7 for lists of Source and Target events.) You can modify these properties for your custom link types.


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