[Lazarus] Multiple copies of same form
Mattias Gaertner
nc-gaertnma at netcologne.de
Sat Sep 14 03:36:07 CEST 2013
On Sat, 14 Sep 2013 03:08:46 +0200
Hans-Peter Diettrich <DrDiettrich1 at aol.com> wrote:
> Timothy Groves schrieb:
> > I would like to write an app that has the following properties:
> >
> > 1) A main form exists, one of which is spawned at program start;
> > 2) Additional copies of the main form may be spawned;
> > 3) The program exits only when no copies of the main form are in
> > existence.
> >
> > I've tried a few things when spawning additional forms, such as
> > form.Create, but when I close the *first* form spawned, *all* such forms
> > are destroyed.
>
> That's the specified behaviour: the first created form becomes
> Application.MainForm, and the program terminates when exactly that form
> is closed.
No. The first form created by Application.CreateForm becomes the
MainForm. Except for splash and mdi forms.
> > I also tried Application.CreateForm, but that doesn't
> > seem to do anything. Google has failed me, as well.
> >
> > What's my best option for this?
Create forms with
Form1:=TForm1.Create(Application);
or:
> I'd keep a dummy MainForm hidden, and count the instances of the other
> forms.
Mattias
More information about the Lazarus
mailing list