Kbase 15282: Using the Smart Object ADM STATE Link: An Example
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  3/8/1999 |
|
Using the Smart Object ADM STATE Link: An Example
The following describes one way in which the STATE link can be
used to cause an internal procedure in Smart Object B to be run
based on an event in Smart Object A.
Assuming two Smart Objects, A and B, which have been placed in a
Smart Window:
1. Create a STATE link with Smart Object A as the source and Smart
Object B as the target.
2. In Smart Object A, add the following to the place in the code
where the event to which you want Smart Object B to react is
detected:
RUN new-state(INPUT "state1").
This will cause a "message" to get sent from Smart Object A to
Smart Object B which indicates that "state1" has occurred in
Smart Object A.
3. In Smart Object B, add code to the state-changed procedure. e.g.:
CASE p-state:
WHEN "state1" THEN DO:
RUN react-to-state1.
END.
END.
This code is what will cause Smart Object B to react to "state1"
(through the state-changed procedure) when Smart Object A sends the
"state1" message across the STATE link.
4. In Smart Object B, add a procedure react-to-state1 which
does whatever Smart Object B should do to react to the "state1"
state signalled by Smart Object A.
As illustrated by the above example, to get a target to react to a
new state in the source, it is necessary to run new-state in the
source. This will cause state-changed to be run in the target of
the link.
For more information, refer to the Chapter, "SmartLinks", in the User
Interface Builder Developer's Guide.
Progress Software Technical Support Note # 15282