Page 1 of 1

How to force on release event executed?

Posted: Wed Dec 22, 2010 8:20 am
by huangchenmin
Hello everyone
there is a procedure whenexit() ,which for on release event.
I hope I can run exe file individual by parameter.
For example,missopd.exe ->normal running,missopd.exe 0 ->do onrelease and close missopd.exe
I had tried setproperty(),do events and fail.
PLS HELP!
Best Regards

Re: How to force on release event executed?

Posted: Wed Dec 22, 2010 12:26 pm
by dhaine_adp
Hi,

Please try including ON INTERACTIVECLOSE on your windows definition:

Code: Select all

 DEFINE WINDOW Form_MOPD;
                AT 08,176;
                WIDTH 885;
                HEIGHT 680;
                TITLE "¹w¬ù¥¼¦^ÃöÃh";                 
                ICON "Default";
                ON Init if(marg==NIL,LoadMIL(),just4Impt()); 
                ON release WhenExit();        
                ON INTERACTIVECLOSE WhenExit();  <<--- Add this line
                MAIN
WhenExit() is triggered on two places:

(1) ON RELEASE, when you do a domethod("Form_MOPD","Release") or Form_MOPD.Release
(2) ON INTERACTIVECLOSE also fires up WhenExit() when you click the Window Close box [x].

IMHO, you can code the exit procedure or application termination as follows



*******************************
function DestroyWindow() // because you declared this window as main, right?

DBCLOSEALL()
DeleteAllYourTempFile() // Your UDF to removed the temporary files used by the apps.
RELEASE ALL
RELEASE WINDOW ALL // this effectively terminates all window. anywhere in your code
// other than here, your application terminates if you issue this command so
// use it with caution
RETURN NIL

Re: How to force on release event executed?

Posted: Wed Dec 22, 2010 12:31 pm
by srvet_claudio
Hi Huangchenmin

Change in your code:

Code: Select all

function just4Impt()
         MsgInfo("here in just4Impt()")
         Form_MOPD.Release
return
I hope have been useful.
Best regards,
Claudio Soto.

Re: How to force on release event executed?

Posted: Wed Dec 22, 2010 12:42 pm
by srvet_claudio
Great Dhaine, very good explanation.
Thanks.
Best regards,
Claudio.

Re: How to force on release event executed?

Posted: Thu Dec 23, 2010 3:20 am
by huangchenmin
dhaine_adp wrote:Hi,

Please try including ON INTERACTIVECLOSE on your windows definition:

Code: Select all

..................
RETURN NIL[/quote]
Thanks for your supports!
Great help to me.
Best Regards
chen min

Re: How to force on release event executed?

Posted: Thu Dec 23, 2010 3:21 am
by huangchenmin
srvet_claudio wrote:Hi Huangchenmin

Change in your code:

Code: Select all

............
return
I hope have been useful.
Best regards,
Claudio Soto.
Thanks for your supports
Simple and useful.
Best Regards
chen min