I remember the days i used to have problems of the application staying
in memory even after i have closed all my forms (and even freed them).
On looking at the TApplication.Run code i found a few interesting thing.
TApplication is created and the run method is called on the project's
main program file (.dpr). and contains the traditional message loop
which terminates when a wm_exit message is received or the *first* from
made by the application.createform procedure is freed.
Another interesting thing is that the application.run method does not
have to be called in order to run the application. The showmodal command
of a form also has a suffecient message loop (for that form) which in
turn can act as the main message loop for the funtion
For a two form application we could change the main program to
program Project1;
uses
Forms,
Unit1 in 'Unit1.pas' {Form1},
Unit2 in 'Unit2.pas' {Form2};
{$R *.res}
begin
Form1:=TForm1.Create(nil);
Form1.ShowModal;
Form1.Free;
Form2:=TForm2.Create(nil);
Form2.ShowModal;
Form2.Free;
end.
Note that there is no application object here but the program runs fine
(as long as the two forms actually exist) - this should work for the
case below having searchform as form2 and connectform as form1 (with
additional code to store database connections and pass it from form1 to
form2)
Another way which is I'd recommend is to properly structure the program
so that there is the main form - from what i see the search form is the
main form because closing it ends the application. and on the search
form's create method, it should create the connect form and destroy it.
This means the search form has everything (the connection etc) and the
login form is just a popup which prompts for information; then the
search form knows what to do with the results.
j
Vishak wrote:
> Hi,
>
> Make "Connecting form" as Main form of application. Open the Search form as modal (ShowModal).
> In "Connecting form", immedietely after you call "ShowModal", call "Application.Terminate"
>
> logic:
> When you display a form using "ShowModal", control will not return to "calling" form until the "called" form is closed.
>
> HTH,
> Vishak
>
>
> --------------------------------------------------------------------------------
> ----- Original Message -----
> From: sonith m
> To: [email protected]
> Sent: Friday, April 28, 2006 3:26 PM
> Subject: [delphi-en] PLease help on form closing help
>
>
>
>
> I have form(coonectinform) there i am giving database name and server name .. clicking ok if databse and server is excist it will show next form (searchform)..
>
> in search form i am using conectin of first form so i cant destory that
> so now what i want is
> on closing of search of i should be able to close complte apliction
> (presently its in memory.. )
>
>
> pleasse help me
>
>
> [Non-text portions of this message have been removed]
>
>
>
> -----------------------------------------------------
> Home page: http://groups.yahoo.com/group/delphi-en/
> To unsubscribe: [EMAIL PROTECTED]
> Yahoo! Groups Links
>
>
>
>
>
>
>
-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED]
SPONSORED LINKS
| C programming language | Computer programming languages | Java programming language |
| The c programming language | C programming language | Concept of programming language |
YAHOO! GROUPS LINKS
- Visit your group "delphi-en" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

