[Lazarus] MDI implementation

Peter Williams pewilliams2010 at live.com
Sun Apr 3 18:16:41 CEST 2011


Hi Daniel,

Date: Sun, 3 Apr 2011 10:28:07 -0300
From: daniel.franzini at gmail.com
To: lazarus at lists.lazarus.freepascal.org
Subject: Re: [Lazarus] MDI implementation

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

I found that my Delphi code does not compile in Lazarus for MDI forms.
http://wiki.lazarus.freepascal.org/MultiDoc
MultiDoc is the Lazarus version of MDI forms.
http://sourceforge.net/projects/lazarus-ccr/files/MultiDoc/MultiDoc%200.2/multidoc-0.2.zip/download
I installed it and ran the demo and found that when I have some child forms, when I close one of the forms I get an EAccess violation error (216) exception.
Does anyone know how we can get rid of this AV error ???
Note the component is dated 2007-01-06 and version 0.2.
Best Regards,Peter / pew

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

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 		 	   		  

--

_______________________________________________

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'')



--
_______________________________________________
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/20110404/4bacf167/attachment-0003.html>


More information about the Lazarus mailing list