1 (edited by mathmathou 2015-03-04 21:51:22)

Topic: Proper closing of the application

Hello Dmitry and all MVD users,


I have a simple (well I think) question about how to "kill" the application created with MVD on exit.


At the moment, here's what I have :

A login form shows at startup and asks for credentials.

After checking the validity of the credentials, the first form hiddes itself and the second form opens with this code :


if (FormLogin = DBLogin) and (FormPassword = DBPassword) and (DBActive = 1) then
    begin
         Form1.Hide;
         Form2.Show;
    end;

Problem is that, after 3 successfull launches and closing  of the application for testing, here is what I have in my list of processes :


http://i.imgur.com/zwIK81G.png


My application is still running.


Now, I'm pretty sure that this is due to the "Form1.Hide" I use, but I don't know what to use instead. I've tried "Form1.Close" but it opens the second Form and then kills the app smile

Any idea for me, or maybe a post related to this same subject you could point me to ?


Thanks in advance and I wish you all a good day.


Mathias

I'm a very good housekeeper !
Each time I get a divorce, I keep the house

Zaza Gabor

Re: Proper closing of the application

You must create a event OnClose for the Form2, where you can close the Form1

procedure Form2_OnClose (Sender: string; Action: string);
begin
    Form1.Close;
end;
Dmitry.

Re: Proper closing of the application

Aaaaaaah, clever : include on the form closed by the user, a procedure to close the intial form !!

That did the trick, thank you smile

I'm a very good housekeeper !
Each time I get a divorce, I keep the house

Zaza Gabor