Just Share my app. I used Link List to do this
procedure close_list_form(formclass:TFormClass);
var
?? _i:integer;
?? _temp:Plistform;
begin
? for _i:=0 to mainform.TB.ButtonCount-1 do mainform.TB.Buttons[0].Destroy;
? _curr:=_head;
? while (_currnil) do
? begin
??? if _curr^.form^.ClassName=formclass.ClassName then
??? begin
????? if _curr^.backnil then
??????? _curr^.back^.next:=_curr^.next;
????? if _curr^.nextnil then
??????? _curr^.next^.back:=_curr^.back;
????? if _curr=_head then _head:=_curr^.next;
????? if _curr=_tail then _tail:=_curr^.back;
????? dispose(_curr);
??? end
??? else
????? mainform.add_menu_btn(_curr^.form^.Caption);
??? _curr:=_curr^.next;
? end;
end;
procedure find_list_form(formclass:TFormClass);
var
?? _find:boolean;
begin
? _curr:=_head;
? _find:=false;
? while (_currnil)and(not _find) do
? begin
??? if _curr^.form^.ClassName=formclass.ClassName then _find:=true
??? else _curr:=_curr^.next;
? end;
end;
function new_list_form(formclass:TFormClass;_par:integer = 0):boolean;
var
?? _flag:boolean;
?? _i:integer;
begin
? _flag:=true;
? find_list_form(formclass);
? if _curr=nil then
? begin
??? try
????? _curr:=new(Plistform);
????? _curr^.back:=nil;
????? _curr^.next:=nil;
????? _curr^.form:=new(Pform);
????? _curr^.form^:=formclass.Create(mainform);
????? mainform.add_menu_btn(_curr^.form^.Caption);
????? if _head=nil then
????? begin
??????? _head:=_curr;
??????? _tail:=_curr;
????? end
????? else
????? begin
??????? _tail^.next:=_curr;
??????? _curr^.back:=_tail;
??????? _tail:=_curr;
????? end;
??? except
??? on Exception do _flag:=false;
??? end;
? end;
? if _currnil then
? begin
??? _curr^.form^.Tag:=_par;
??? _curr^.form^.Show;
? end;
? Result:=_flag;
end;?
Do you find any problem ? Thanks
=============INTOSOFT============
ALEXIO CHAOS
Yahoo Messager
=================================
--- On Tue, 2/3/09, Malcolm Poole wrote:
Earlier message 24 lines
From: Malcolm Poole
Subject: Re: [Lazarus] creating multiple non-modal form instances
To: "General mailing list"
Date: Tuesday, February 3, 2009, 11:52 AM
Graeme Geldenhuys wrote:
> How do I track such instances? By tracking I mean something like a MDI
> interface's 'Windows' menu item?
> My application is a SDI style app. If the user has many forms open, I
> want them to somehow be able to bring a certain form to the front. Or
> should I not bother and they simply use the taskbar for that.? Then
> again, what if the app is run under Linux and the window manager
> doesn't have a taskbar?
>
>???
My first commissioned app worked like that - you could open any number
of reports which used the same forms and could be accessed by a
dynamically created menu on the main form. If I remember correctly I had
a TList to which each form was added as it was created and when the
report forms closed they called a procedure of the main form which
removed them from the TList.
Regards,
Malcolm