Answered Persistent run

Hi,

I'm a bit confused about the run persistent .

I know how to use it for a .p procedure, but in some old programs i found "run myWindow persistent set myHdl" .
But when I replace the myWindow by a new one, my Windows don't show up but she is runing. Do you know why ?

Best Regards,

- BobyIsProgress -
 

Osborne

Active Member
It seems to suggest that your replacement that you are now running persistent does not have any code in it to view the window.

Maybe myWindow did have, or the viewing of the window is being activated by the calling program thus the reason for setting a handle. Setting a handle for a persistent program allows you to run internal procedures or dynamic functions in the persistent run program. E.g.:
Code:
run myWindow persistent set myHdl.

RUN view_window IN myHdl.
 
I was aware of that point.

But the think is I don't know how to display it.
I tried :
Code:
W-Win:hidden = false.
W-Win:move-to-top() .

But didn't seem to work.

Best Regards,

- BobyIsProgress -
 

RealHeavyDude

Well-Known Member
When you build a new window in the good ole AppBuilder it will generate a lot of code for you which will automatically work in almost all situations. The highlighted code does the trick ( enable_UI contains the code to view the window ) and the next statement makes sure that, when you run it persistent, it does not go out of scope.

Code:
/* ***************************  Main Block  *************************** */

/* Set CURRENT-WINDOW: this will parent dialog-boxes and frames.        */
ASSIGN CURRENT-WINDOW                = {&WINDOW-NAME}
       THIS-PROCEDURE:CURRENT-WINDOW = {&WINDOW-NAME}.

/* The CLOSE event can be used from inside or outside the procedure to  */
/* terminate it.                                                        */
ON CLOSE OF THIS-PROCEDURE
   RUN disable_UI.

/* Best default for GUI applications is...                              */
PAUSE 0 BEFORE-HIDE.

/* Now enable the interface and wait for the exit condition.            */
/* (NOTE: handle ERROR and END-KEY so cleanup code will always fire.    */
MAIN-BLOCK:
DO ON ERROR   UNDO MAIN-BLOCK, LEAVE MAIN-BLOCK
   ON END-KEY UNDO MAIN-BLOCK, LEAVE MAIN-BLOCK:
  RUN enable_UI.
  IF NOT THIS-PROCEDURE:PERSISTENT THEN
    WAIT-FOR CLOSE OF THIS-PROCEDURE.
END.
 
Hi,

Thank you for your detailled answer.

I just did some check and in the mainblock section I have an prorietary include (developped by my ERP editor) that should do the trick. But I think he is disturbed by the persistent run.

I will have to check with them first.

Best Regards,

- BobyIsProgress -
 
Top