[Lazarus] embedding fomrs into forms

Marc Santhoff M.Santhoff at t-online.de
Sat May 17 17:29:41 CEST 2008


Am Samstag, den 17.05.2008, 16:36 +0200 schrieb Mattias Gaertner:
> On Sat, 17 May 2008 16:03:24 +0200
> Marc Santhoff <M.Santhoff at t-online.de> wrote:
> 
> > Am Samstag, den 17.05.2008, 14:15 +0200 schrieb Marc Santhoff:
> > > Hi,
> > > 
> > > is it possible to use a TForm inside a TForm?
> > > 
> > > Imagine a program consisting of a frame and some plug-ins. The
> > > plug-ins should get designed using lazarus, each having it own
> > > form. When loaded those forms would be embedded into the main
> > > applications form as a frame, e.g. each on a tab of a notebook or
> > > similar.
> > 
> > Testing showed it does not work, if done like this:
> > 
> > procedure TForm1.FormCreate(Sender: TObject);
> > var
> >   f2: TForm;
> > begin
> >   f2 := TForm2.Create(Panel2);
> >   f2.show;
> > end;
> 
> The parameter to the Create constructor is the 'Owner', it does not set
> the 'Parent'. Use instead:
> 
>   f2 := TForm2.Create(Panel2);
>   f2.Parent:=Panel2;
>   f2.Visible:=true;

(mumble) ... I think I have to re-learn a lot of things.

It does work perfectly and one can see it too if the position is set
accordingly (f2.left/top := 0). :)

> > the secomd form is shown seperately and managed by the window manager.
> > Using MDI didn't do it either.
> > 
> > > If it is not possible, what alternative ways of designing something
> > > like that should I consider?
> > 
> > The last possibilities I see are streaming parts of the form myself or
> > using the dock manager thingy. Can someone explain how docking would
> > be done (or point me to the docs), please?
> 
> Here is a start:
> http://wiki.lazarus.freepascal.org/Docking

Wonderful, thank you.

Marc





More information about the Lazarus mailing list