does FormClose have some special magic?



I have a login screen. If the username and password are ok, then I want
that screen to close, and the splash/loading screen to appear.

At the end of the password validation code I have
form1.show; {loading screen}
close; {causes the application to terminate}

Here's FormClose:

procedure TPasswordDlg.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
passwordDlg.Release; {global variable for the password screen}
PasswordDlg := nil;
end;


Now I have a cancel button whose handler calls application.terminate,
but otherwise I don't every try to terminate.

Now, here's where the "magic" comes in.

I created a procedure *with the same code* and the application doesn't
terminate. The loading screen appears the way it should.

Here it is:

procedure TPasswordDlg.closeDontTerminate;
begin
PasswordDlg.release;
PasswordDlg := nil;
end;


Why? My best guess is that the dpr only creates the password form, and
when it closes, that's it, the app terminates.
Application.CreateForm(TPasswordDlg, PasswordDlg);

However, when I create the loading form in the password validation
code, I do
Application.CreateForm(TForm1, Form1);

So shouldn't that register that there is another form to the
application, and thereby prevent it from terminating when the first
form closes?

When I tried putting both CreateForm statements in the dpr, and called
close, the application still terminated, instead of showing form1.

I'm missing something somewhere...

-Corinna

.