[Lazarus] MDI implementation

Daniel Franzini daniel.franzini at gmail.com
Sun Apr 3 15:28:07 CEST 2011


Thank you, Peter.

I already tried in Delphi and it works fine. I wanted to do this in Lazarus
because I intended it to work in Linux too.

But thanks anyway for the tip and the code.

2011/4/2 Peter Williams <pewilliams2010 at live.com>

>  Hi Daniel,
>
> ------------------------------
> Date: Sat, 2 Apr 2011 19:02:46 -0300
> From: daniel.franzini at gmail.com
> To: lazarus at lists.lazarus.freepascal.org
> Subject: [Lazarus] MDI implementation
>
>
> Hi there.
>
> I'm trying to write a MDI application in Lazarus (Win32/Vista, Lazarus
> 0.9.31).
>
> I created the main form and set its FormStyle property to fsMDIForm. Then I
> created the child form and set its FormsStyle to fsMDIChild.
>
> I also created a menu where I can start a new form. I moved the child form
> the non-automatic-created form list. And used the following code to create
> it:
>
> -----------------
> procedure TfrmMain.mnuEntrarDadosClick(Sender: TObject);
> var frmChild: TfrmRelatVend;
> begin
>     frmChild := TfrmRelatVend.Create(self);
>     frmChild.Show;
> end;
> -----------------
>
> I also wrote a formClose handler for the child so it gets freed when I
> close it.
> -----------------
> procedure TfrmRelatVend.FormClose(Sender: TObject;
>     var CloseAction: TCloseAction);
> begin
>     CloseAction := caFree;
> end;
> -----------------
>
> >Altough the form gets created and shows up, it does not have a MDI
> behavior, eg, it does not "stay" in the limits of its parent form and it
> gets maximized on top of its parent form.
>
> >What am I doing wrong?
>
> >thank you
>
> I cannot tell you exactly what you're doing wrong, but I can do the next
> best thing.
>
> I have a Simple_Ed (simple text editor) which supports unlimited MDI child
> text windows working.
>
> You can find it here:
>
> https://sites.google.com/site/pewtas/home/delphi_source_code
>
> <https://sites.google.com/site/pewtas/home/delphi_source_code>and the
> download for the Delphi 7 source code is here:
>
> simple_ed_005_src.zip <https://sites.google.com/site/pewtas/simple_ed_005_src.zip?attredirects=0>19
> KB - The Delphi source code files only
>
> (Note that this has a main form and a child MDI form).
>
> Best Regards,
> Peter / pew
>
> --
> >Daniel
>
> "Let us change our traditional attitude to the construction of programs.
> Instead of imagining that our main task is to instruct a computer what to
> do, let us concentrate rather on explaining to human beings what we want a
> computer to do." (Donald Knuth)
>
> "Yes, technogeeks can be funny, even if only to each other." (
> http://www.boogieonline.com/revolution/science/humor/)"
>
> "Man is driven to create; I know I really love to create things. And while
> I'm not good at painting, drawing, or music, I can write software."
> (Yukihiro Matsumoto, a.k.a. ``Matz'')
>
> -- _______________________________________________ Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
>


-- 
Daniel

"Let us change our traditional attitude to the construction of programs.
Instead of imagining that our main task is to instruct a computer what to
do, let us concentrate rather on explaining to human beings what we want a
computer to do." (Donald Knuth)

"Yes, technogeeks can be funny, even if only to each other." (
http://www.boogieonline.com/revolution/science/humor/)"

"Man is driven to create; I know I really love to create things. And while
I'm not good at painting, drawing, or music, I can write software."
(Yukihiro Matsumoto, a.k.a. ``Matz'')
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20110403/33c877fb/attachment-0003.html>


More information about the Lazarus mailing list