Answered Consecutively run two procedures

ezequiel

Member
Hello, I have a code portion like this:

RUN wProc1.r ("001","ADMIN").
RUN wProc2.r ("001",YEAR(TODAY)).

Both are smartwindows with smartbrowses. I need to have both windows opened, but when I execute this only the first window opens, and the second one appears when I close the first.

Is it possible, to have both windows opened?

Windows 8.1, Progress 9.1C
 

TheMadDBA

Active Member
It has been a million years since I have used 9.1C but...

RUN wProc1.r ("001","ADMIN") PERSISTENT.
RUN wProc2.r ("001",YEAR(TODAY)) PERSISTENT.

You probably also want to use PERSISTENT SET <handle variable> so you can keep track/clean up the windows when the parent closes.
 

ezequiel

Member
Well, I couldn't do it right.
I've patched this issue with a series of conditions and just one of the browses display. But it'not the best way.
 

progdev1

Member
The following comes with a health warning - I haven't used smart objects in a good few years.
I created a smart window swin-1.w, a smart data object that queried the sports2000 customer table, a smart browser and a smart panel to navigate the smart browse. I successfully linked all the smart objects so that they worked together.
I then repeated this task for suppliers, I called the program swin-2.w.
I then created a third parent smart window swin-0.w with two buttons Run and Exit; and the following bit of code in the run trigger worked for me.
I can also click either window to ensure that the supplier or customer smart window in on top.
Code:
&Scoped-define SELF-NAME btnRun
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btnRun wWin
ON CHOOSE OF btnRun IN FRAME fMain /* Run */
DO:
    DEFINE VAR vhdl1 AS HANDLE NO-UNDO.
    DEFINE VAR vhdl2 AS HANDLE NO-UNDO.
 
    RUN swin-1.w PERSISTENT SET vhdl1.
    RUN swin-2.w PERSISTENT SET vhdl2.
 
    RUN ENABLE_ui IN vhdl1.
    RUN adm-create-objects IN vhdl1.
    RUN initializeObject IN vhdl1.
 
    RUN ENABLE_ui IN vhdl2.
    RUN adm-create-objects IN vhdl2.
    RUN initializeObject IN vhdl2.
END.

/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
I'm not sure if your are trying to run the two programs from a *.p or *.w.
If you are running from a *.p as Tom above rightly said you might need to put WAIT-FOR "CLOSE" OF THIS-PROCEDURE or something similar in the parent *.p

If you have done all this and you are still only seeing one screen, check that your container objects are definitely smart windows. If they are smart dialog then this may be why you are only seeing one at time.

The code above might not be 100% in terms of optimisation or unnecessary duplication. You might need to play around with it and check this.
Hope this helps
 

ezequiel

Member
That did it, progdev1, thank you!

One of the .w is a smartwindow, it run using PERSISTENT SET.
The second .w is a window (it includes a PSTIMER), it runs after the other one like this:
RUN wProc1.r ("001","ADMIN").

Thanks everyone for your help!
 
Top