[Lazarus] MDI implementation

Daniel Franzini daniel.franzini at gmail.com
Sun Apr 3 00:02:46 CEST 2011

Hi there.

I'm trying to write a MDI application in Lazarus (Win32/Vista, Lazarus

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

procedure TfrmMain.mnuEntrarDadosClick(Sender: TObject);
var frmChild: TfrmRelatVend;
    frmChild := TfrmRelatVend.Create(self);

I also wrote a formClose handler for the child so it gets freed when I close
procedure TfrmRelatVend.FormClose(Sender: TObject;
    var CloseAction: TCloseAction);
    CloseAction := caFree;

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


"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." (

"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/20110402/06a9a792/attachment-0002.html>

More information about the Lazarus mailing list