persistent window/independent window

jmac13

Member
Hi All,

I've got a program which is a menu program that runs another .w as a persistent. So I've got two windows at the same time but I want the second window to close when the first window gets closed. On the Exit of the menu program (the first program) I run something so the second window runs apply "close" to this-procedure. The UI gets killed off but the second program is still there waiting for a close. So when i do apply "close" to this-procedure in the menu program the second one gets killed off and not the menu program. Then menu programs UI is gone but its stuck in the main block waiting for a close.


So my question is how can i run these two Independently then kill them both when the user exits the system?

im guessing i really shouldnt be running it like im doing from the menu program

Thanks
 
The easiest way would surely be to keep a track of the handles to the persistent procedures and RUN CLOSE-PROC IN lv-Handle for each valid one? Then just close them off in CLOSE-PROC. Make sure you tidy the handles too I guess.
 
when you say RUN CLOSE-PROC IN lv-Handle can you actual run a proper close of the persistent rather than the way I've done it. which is a procedure that runs apply "close" to this-procedure (which doesn’t seem to work correctly)
 
I'm not certain, but I think actually if you DELETE OBJECT lv-Handle. in the calling procedure it will do you what you want. You just have to make sure that any tidy up of handles and dynamic objects in the persistent procedure is run first.
 
I was being dense... I the main block of the second program I was waiting rather than just returning....so it was never getting back to the first program correctly... so now it sits there happy and I can close it properly. Right lets see if I can get it work smoothly..

Thanks for the help im sure ill need some more before the end:)
 
the main prob I’m having now is my confusion with the use of CURRENT-WINDOW.... from my second program I run another program which hides its calling program window. To spawn this off do I have to create another window or can I just go here you go look after ur self.
 
Hi Jmac13, perhaps this example will serve.

Code:
/* When you close the main window (winCustomer) also closes the child window (hOrder) */
ON WINDOWS-CLOSE OF WinCustomer
DO:
  /* This ADM code must be left here in order for the SmartWindow
     and its descendents to terminate properly on exit. */


    IF VALID-HANDLE(hOrder) THEN
        RUN exitObject IN hOrder.  /* Close second Window */


  APPLY "CLOSE":U TO THIS-PROCEDURE.
  RETURN NO-APPLY.
END.




/* Run the second window in a persistent manner */
ON 'CHOOSE' OF ButtonOrder
DO:
   IF NOT VALID-HANDLE(hOrder) THEN DO:
       RUN w-order.w PERSISTENT SET hOrder (INPUT h_d-order /* SDO of Order */ ).
       RUN InitializeObject IN hOrder.
   END.
   ELSE RUN viewObject IN hOrder.
END.

Regards.
 
So how are you dealing with current window? When you start the program are you creating your own window then assigning it to the current window?
 
Hi Jmac13, I send file "jmac13.zip" an example of a main window that invokes a second window, I'm working with V9.1D07 and I suppose in a later version should also work. The example is made with SmartObjects, please check the trigger of the [Order-Button] and the trigger [window-close] in the main window. Perhaps will serve...View attachment jmac13.zip
 
Cheers Serigoc,

I'm OK with creating the program a persistent and closing it down now seems to be ok. It’s the current window I seem to have issues with I don’t really understand if it’s a session thing or per window.. I’ll post another thread
 
Back
Top