Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MDI Form and MDI Child

Status
Not open for further replies.

new2delphi

Programmer
Oct 16, 2003
9
0
0
AU
As default, everytime I set up a MDI Form and whenever I add a normal form and set the formstyle to 'MDICHild', it always showing up when I run the main MDI window and when I click on the 'X' button to close it, it is always minimizing. Anybody knows why is this happening? Thanks for your time!

-Tom
 
the forms being created on execution of your app

you need to go into project options and remove your child form from the autocreate list

you need to create and destroy your child forms by code.
if you need to know how just ask ..
 
Hi,

I did changed now all I want to do is that when I click on "New" menu bar, I need to display the "WizardFrm". I was wondering if you could show me how. Thanks again. I have the following:

Unit2.WizardFrm.Show;

However, it won't work.
 
In the menus "New" onclick event put

if WizardFrm=nil then Application.CreateForm(TWizardFrm, WizardFrm);



in the WizardFrm onclose event put

Action:= caFree;
WizardFrm:= nil;

the "if WizardFrm=nil" bit stops another instance of the form being created if 1 already exsists, if you want more than 1 remove "if WizardFrm=nil then"
 
I have another question. How do I make it so that the Child Form will display in the center or wherever I put it in instead of displaying on the left side? Thanks again.
 
i use a form placement component that saves the form size, state & position to the registry
its great just place the component on any form and set a couple of properties..
its a free set of components called rxlib avaliable here
good luck
 
if you just want the form centered you could calculate it and put it there yourself.

the last time i did it i think it went something like

mdichild.left:=mdiform.clientwidth div 2-mdichild.width div 2
mdichild.top:=mdiform.clientheight div 2-mdichild.height div 2

the clientheight & clientwidth is the useable area of the form if you put a toolbar on the top you have to work its hight into the calculation.
 
Thank you. After I have installed, how do I add it to the form? Where can I find this component? Sorry for lot of newbie questions.


-Tom
 
just grab the formplacement component and drop it on the form , like any component.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top