Solved

Embedding child forms

Posted on 2001-09-07
5
213 Views
Last Modified: 2010-04-06
I would like to be able to embed child forms inside a panel on the parent form. Previously I used to achieve this by using mdi, but would like to avoid using that if possible. I currently do it by assigning the handle of the panel to the ParentWindow property of the child form. Although the child form appears ok and is usable, it's not sized correctly. Its aligned alClient so should fill the contents of the panel but seems to be to wide and an tall. Have I missed something or is there a better way of embedding forms.

Thanks

Jo
0
Comment
Question by:nnbbb09
  • 2
  • 2
5 Comments
 
LVL 1

Expert Comment

by:Phoenix_s
ID: 6464626
there's frames..  afaik they're available in delphi 5 and up.

here's a snippet about them from the d5 help file

When you create frames, they are implemented as descendants of TFrame.

A frame, like a form, is a container for other components. It uses the same ownership mechanism as forms for automatic instantiation and destruction of the components on it, and the same parent-child relationships for synchronization of component properties. But frames can be nested within forms or other frames, and they can be saved on the Component palette for easy reuse. After a frame is created and saved, it continues to function as a unit and to inherit changes from the components (including other frames) it contains. Moreover, an embedded frame continues to inherit changes made to the frame from which it is derived.
0
 
LVL 3

Author Comment

by:nnbbb09
ID: 6464690
Phoenix s - Thanks, but I've already explored using frames. I'm using the Developer Express toolbar components and they must have a TCustomForm as their owner. Thanks anyway.

Jo
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6465072
simple use yourformobject.parent := panel1;
0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 100 total points
ID: 6465149
hi again,

a sample from a project of mine
(i've overloaded the constructor of my to embedding childform)

--part paste
...
  public
    Constructor Create(AOwner : TComponent;
                       AParent : TWinControl); OverLoad;
  end;

var
  frmac: Tfrmac;

implementation
{$R *.DFM}


Constructor Tfrmac.Create(AOwner : TComponent;
                          AParent : TWinControl);
begin
  Inherited Create(AOwner);
  Align := alClient;
  BorderStyle := bsNone;
  Parent := AParent;
  Show;
end;

....
-- part paste end
and i use for create
(even i must not use a reference var in my case)

  with TfrmAC.Create(self,panACSource) do;

other ways are also possible

meikl ;-)
0
 
LVL 3

Author Comment

by:nnbbb09
ID: 6465347
Thanks Meikl.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

706 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now