Solved

Embedding child forms

Posted on 2001-09-07
5
218 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
[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
  • 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

732 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