?
Solved

dock on startup

Posted on 2000-05-08
3
Medium Priority
?
289 Views
Last Modified: 2010-04-04
I have a MainForm with a panel and 2 orher forms(form 1 and form 2)
how can i dock form1 and form2 automatic to MainForm when MainForm is shown

0
Comment
Question by:delpro
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 2

Expert Comment

by:aubs
ID: 2788371
Assuming that you have set your panel to be a docksite, you can use the manualdock method:


//in form1
public
    { Public declarations }
  procedure DockMe(NewDockSite: TWinControl);

procedure TForm1.DockMe(NewDockSite: TWinControl);
begin
  form1.ManualDock(NewDockSite);
end;

//in form2
public
    { Public declarations }
  procedure DockMe(NewDockSite: TWinControl);

procedure TForm2.DockMe(NewDockSite: TWinControl);
begin
  form2.ManualDock(NewDockSite);
end;

//in Mainform

procedure TMainForm.FormShow(Sender: TObject);
begin
  form1.Show;
  form1.DockMe(Panel1);
  form2.Show;
  form2.DockMe(Panel1);
end;


This could be improved by creating a decendent form TDockingForm which has the DockMe procedure already build in. Then create forms 1 & 2 as TDockingForms. This probably is not worth the effort for just 2 forms, but may be worth considering if you have several forms to dock.

The DockMe procedure could also be improved to include alignment parameters, see the on line help for ManualDock.




procedure TForm1.DockMe(NewDockSite: TWinControl,ControlSide: TAlign = alNone);
begin
  form1.ManualDock(NewDockSite, ControlSide);
end;
0
 

Author Comment

by:delpro
ID: 2788473
Thanks
0
 
LVL 2

Accepted Solution

by:
aubs earned 80 total points
ID: 2788651
Does that mean you accept this as an answer?
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question