Solved

Embedding child forms

Posted on 2001-09-07
5
217 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

828 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