![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 7 of 7 total |
![]() |
Mon, Feb 5 2018 10:41 PM | Permanent Link |
Paul Coshott | Hi All,
I am creating a TBasicPanel at run time, and then I want to create a TLabel within the TBasicPanel, but I'm not sure how to reference the parent control (the newly created TBasicPanel) when creating the TLabel. Thanks, Paul ----------------------------------------------------------------------------------------- procedure TfSchedule.Button7Click(Sender: TObject); var sBPName : string; begin ScrollPanel1.BeginUpdate; try with TBasicPanel.Create(ScrollPanel1) do begin iComp := iComp + 1; sBPName := 'panDay' + IntToStr(iComp); Name := sBPName; Layout.Position := lpTopLeft; Layout.Stretch := lsBottom; Layout.Consumption := lcRight; Background.Fill.Color := clLightSkyBlue; Width := 300; end; with TLabel.Create( ???????? ) do begin ///// how do I reference the parent control ?? AutoSize.Height := False; AutoSize.Width := False; Layout.Position := lpTopLeft; Layout.Stretch := lsRight; Layout.Consumption := lcBottom; Caption := 'Monday'; end; finally ScrollPanel1.EndUpdate; end; end; ----------------------------------------------------------------------------------------- |
Mon, Feb 5 2018 11:46 PM | Permanent Link |
Rick | On 06/02/18 14:41, Paul Coshott wrote:
> > I am creating a TBasicPanel at run time, and then I want to create a TLabel within the TBasicPanel, but I'm not sure how to reference the parent control (the newly created TBasicPanel) when creating the TLabel. > > Probably the easiest way is to use a local variable when creating the basic panel. var bp: TBasicPanel; try bp:=TBasicPanel.Create(ScrollPanel1); with bp do begin end; with TLabel.Create(bp) do begin end; finally end; -- Rick |
Tue, Feb 6 2018 2:09 AM | Permanent Link |
Paul Coshott | wrote:
> Probably the easiest way is to use a local variable when creating the > basic panel. That worked perfectly. Thanks heaps. Cheers, Paul |
Tue, Feb 6 2018 2:10 AM | Permanent Link |
Michael Dreher | Paul Coshott wrote:
// ... how to reference the parent control ... Another method using nested with statements, assuming here the name of the form is 'Form1'. procedure TForm1.Button1Click(Sender: TObject); var sBPName : string; begin with TBasicPanel.Create(ScrollPanel1) do begin iComp := iComp + 1; sBPName := 'panDay' + IntToStr(iComp); Name := sBPName; Layout.Position := lpTopLeft; Layout.Stretch := lsBottom; Layout.Consumption := lcRight; Background.Fill.Color := clLightSkyBlue; Width := 300; with TLabel.Create(Form1.FindComponent(Name, true)) do begin Layout.Position := lpTopLeft; Caption := 'Monday'; end; end; end; M.Dreher |
Tue, Feb 6 2018 2:42 AM | Permanent Link |
Uli Becker | Hi Paul,
just to let you know: I posted a custom component TCaptionPanel. Uli |
Tue, Feb 6 2018 3:07 AM | Permanent Link |
Paul Coshott | Uli Becker wrote:
> just to let you know: I posted a custom component TCaptionPanel. Hey Uli, Cool, thanks. I'll check it out. Cheers, Paul |
Tue, Feb 6 2018 4:32 AM | Permanent Link |
Matthew Jones | Rick wrote:
> Probably the easiest way is to use a local variable when creating the basic panel. Indeed. ("With" bites again. 8-) -- Matthew Jones |
This web page was last updated on Wednesday, March 29, 2023 at 12:35 AM | Privacy Policy![]() © 2023 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |