[Lazarus] creating multiple non-modal form instances

Michael Van Canneyt michael at freepascal.org
Tue Feb 3 10:20:43 CET 2009



On Tue, 3 Feb 2009, Graeme Geldenhuys wrote:

> Hi,
> 
> I have a listing screen (grid based) that allows various views and
> filters - selected by the user. I want the user to be able to open
> multiple instances of that listing screen. Each with there own views
> and filters.
> 
> How do I create such multiple instances?
> Do I keep calling something like the following:
>    Application.CreateForm(TLearnerListForm, frmBrLearners);
> 
> frmBrLearners being a global variable of TLearnerListForm. Though I
> hate global variable!

Just do a 

  With TLearnerListForm.Create(Application) do
    begin
    Initialize;
    Show;
    end;

You can keep track of them with the Screen.Forms property:

For I:=0 to Screen.FormCount-1 do
  If Screen.Forms[i] is TLearnerListForm then
 
and that's it. 
Well, at least in Delphi, but I assume lazarus can do the same.


Michael.



More information about the Lazarus mailing list