[Lazarus] MDI implementation

Peter Williams pewilliams2010 at live.com
Sun Apr 3 00:26:44 CEST 2011


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
and the download for the Delphi 7 source code is here:
simple_ed_005_src.zip 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 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20110403/0ded1d1c/attachment-0003.html>


More information about the Lazarus mailing list