Board index » delphi » How to embed a form on a panel?

How to embed a form on a panel?

Hi folks!

I want to embed a form on a panel of another form like in MS-Access
(subform).

On my first form I have two panels divided by a splitter. On the lower panel
I want to insert and show the second form.

Can you tell me how to do that?

Thanks for help!

Manuel
cadis...@aon.at

 

Re:How to embed a form on a panel?


Hi there,

try Form2.Parent := Panel2;

good luck!

Martijn

--
Martijn Tonies
http://surf.to/seal97

<none of the text written above has got anything to do with Euro Partners
Informatici BV>

System Development
Euro Partners Informatici BV
http://www.euro-partners.nl

Manuel Gombocz heeft geschreven in bericht
<6p9dgo$bs...@garion.telecom.at>...

Quote
>Hi folks!

>I want to embed a form on a panel of another form like in MS-Access
>(subform).

>On my first form I have two panels divided by a splitter. On the lower
panel
>I want to insert and show the second form.

>Can you tell me how to do that?

>Thanks for help!

>Manuel
>cadis...@aon.at

Re:How to embed a form on a panel?


For the form you want to display in the lower panel you override the
CreateParams method and add the following code:

procedure TLowerPanelForm.CreateParams(var Params: TCreateParams);
begin
  inherited CreateParams(params);
  with params do
  begin
    { assign WndParent to the handle of the form on which the lower panel
is located }
    WndParent:= Application.MainForm.Handle;
   { If you want to create a window without a title-bar }
    Style:= WS_CHILD or WS_CLIPCHILDREN;  
    x:= 0;
    y:= 0;
  end;
end;

In the main form (in the OnShow event-handler for instance) you assign the
Parent property of the TLowerPanelForm to the object LowerPanel. Call
Show/Hide to display (or not) the form. I'm not sure if you have to call
the SetBounds method to size the form correctly.
--
Felix Venniker

fvenni...@landmarksdg.com

Manuel Gombocz <m.gomb...@aon.at> wrote in article
<6p9dgo$bs...@garion.telecom.at>...

Quote
> Hi folks!

> I want to embed a form on a panel of another form like in MS-Access
> (subform).

> On my first form I have two panels divided by a splitter. On the lower
panel
> I want to insert and show the second form.

> Can you tell me how to do that?

> Thanks for help!

> Manuel
> cadis...@aon.at

Other Threads