[Lazarus] "-Or compiler option" + class property and external lib call

Alexander Kaupp aka tanila tanila at tanila.de
Thu Feb 5 09:18:17 CET 2009


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 (_curr<>nil) do
  begin
    if _curr^.form^.ClassName=formclass.ClassName then
    begin
      if _curr^.back<>nil then
        _curr^.back^.next:=_curr^.next;
      if _curr^.next<>nil 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 (_curr<>nil)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 _curr<>nil then
  begin
    _curr^.form^.Tag:=_par;
    _curr^.form^.Show;
  end;
  Result:=_flag;
end;  

Do you find any problem ? Thanks


=============INTOSOFT============

           ALEXIO CHAOS

   Darmawan_Sugiarto at yahoo.com   

          Yahoo Messager

=================================

--- On Tue, 2/3/09, Malcolm Poole <malcolm at lingua-z.co.uk> wrote:

From: Malcolm Poole <malcolm at lingua-z.co.uk>
Subject: Re: [Lazarus] creating multiple non-modal form instances
To: "General mailing list" <lazarus at lazarus.freepascal.org>
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
_______________________________________________
Lazarus mailing list
Lazarus at lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20090203/f51994c4/attachment-0007.html>


More information about the Lazarus mailing list