[Lazarus] creating multiple non-modal form instances

Michael Van Canneyt michael at freepascal.org
Tue Feb 3 10:33:45 CET 2009



On Tue, 3 Feb 2009, Graeme Geldenhuys wrote:

> On Tue, Feb 3, 2009 at 11:16 AM, Graeme Geldenhuys
> <graemeg.lists at gmail.com> wrote:
> >
> > How do I create such multiple instances?
> 
> The following seems to work.... Anybody see any issues with this?
> 
> ========================
> procedure DisplayLearners;
> var
>   frm: TLearnerListForm;
> begin
>   frm := TLearnerListForm.Create(Application);
>   { very basic unique name and should probably be improved}
>   frm.Name := frm.Name + IntToStr(Screen.FormCount + 1);

That will break if you have for example 5 forms, close form 4 and then
create a new form.

Michael.

>   frm.Show;
> end;
> ========================
> 
> 
> Also, TLearnerListForm's CloseAction is set to caFree in the OnClose
> event handler.
> 
> 
> Regards,
>   - Graeme -
> 
> 
> _______________________________________________
> fpGUI - a cross-platform Free Pascal GUI toolkit
> http://opensoft.homeip.net/fpgui/
> _______________________________________________
> Lazarus mailing list
> Lazarus at lazarus.freepascal.org
> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
> 



More information about the Lazarus mailing list