Communication between Smart Objects

Maviee

New Member
Hi,

this might be a more or less easy question for the experts here, but I still can't get it work properly.

Let's assume this: I have a SmartWindow with a SmartViewer and a SmartBrowser. In my Viewer is a button which has to call a function (or procedure) in the SmartBrowser. The question is, how does this work ?

Placing the button on the SmartWindow itself and running the procedure from there is easy with

Code:
RUN MyProcedure IN SmartBrowserHandle.

This method just don't work from a SmartObject to another, because they don't know the handles of each other.

So is it possible to run a procedure without too much work from one SmartObject in another ?

Thx in advance
Mav
 
You can pass a child's handle from the parent to another child.

You can also SUBSCRIBE one child to another child's PUBLISHED event from the parent.


Lee
 

HaraldK

New Member
Hello Mav,

There are different possibilties in V8 or V9 to find out the handles of other smart objects. But in every case it is (as far as I know) necessary to have a link between the objects. If there is no standard link (container, record..) existing, you can create your own link between the objects.

For example in V8:

Example 1
RUN get-link-handle IN adm-broker-hdl (INPUT THIS-PROCEDURE, INPUT 'container-source':U, OUTPUT c-handles).
h-hd = WIDGET-HANDLE(ENTRY(1,c-handles)).
THEN RUN <procedure> IN h-hd.

Example 2
RUN get-link-handle IN adm-broker-hdl
(INPUT THIS-PROCEDURE, INPUT 'record-target':U, OUTPUT c-handles).
DO i = 1 to NUM-ENTRIES(c-handles): /* there can be more than 1 record-target */
h-hd = WIDGET-HANDLE(ENTRY(i,c-handles)).
IF VALID-HANDLE(h-hd)
THEN DO:
RUN set-attribute-list IN h-hd ('ident-number=' + FILL-IN_ident-number).
END.
END.

You can use <link-type>-target or <link-type>-source also for your own defined link-types.



V9:
Example 1
DEFINE VARIABLE hWin AS HANDLE NO-UNDO.
hWin = WIDGET-HANDLE(dynamic-function('linkHandles':U, 'Container-Source':U)).
RUN ViewPage IN hWin (8).

Example 2
DEFINE VARIABLE hDataSource AS HANDLE NO-UNDO.
DEFINE VARIABLE pcSuppNr AS CHARACTER FORMAT "X(10)" NO-UNDO.
hDataSource = WIDGET-HANDLE(dynamic-function('linkHandles':U, 'Data-Source':U)).
RUN <procedure> IN hDataSource.


Another possibility (but I have no experience with this technique) is PUBLISH and SUBSCRIBE. , which also allows you to establish a communication between smart objects.

Kind regards
Harald
 

joey.jeremiah

ProgressTalk Moderator
Staff member
if it's specific to this program
put the button and it's trigger in the container

then use their object handles
to manipulate them


for a more moduler solution
you can either define a dynamic or static link

it's much simpler then you'd think
in your edocs, adm and smartobject \ smartlinks \ defining smartlinks


ofcourse you can also follow the links
from viewer to container to browser to get the objects handle

but that wouldn't be very moduler
and would make the object unsuitable for other uses, good luck !
 
Old methods

Greetings,
I have noted the replies to this thread and my thoughts are this.

Progress (PSC / PRGS) has now made a move away from the Smart Link approach. Using the RUN get-link-handle methods of ADM(1) so learning how to do it in V9 seems pointless. PSC have now made a move towards the PUBLISH / SUBSCRIBE mecanism for the later versions inc Progress Open Edge 10 ... The ADM has not changed from ADM2, though it is now a preffered approach to PUBLISH an event. Move with the times, Progress is dynamic so be dynamic yourself. The RUN ... approach is old.
 

Maviee

New Member
Hi again,

seems there are plenty of methods for the communication between the smart objects or procedures itself.

I tried every solution so far and although I like to go with the progress of the programming language, I'll use the V9 methods for my purposes (although the Publish/Subscribe method is also pretty neat).

So again, thanks for all the answers :)
Mav
 
Top