Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi Control im dynamisch erstellten Form ansprechen (https://www.delphipraxis.net/151022-control-im-dynamisch-erstellten-form-ansprechen.html)

stifflersmom 3. Mai 2010 15:14


Control im dynamisch erstellten Form ansprechen
 
Moin moin,

wie spreche ich ein Control an,
dass ich dynamisch erzeugt habe und in einem Frame
(in diesem Fall ein Panel) anzeige.

Delphi-Quellcode:
  Application.CreateForm(Tma_planung_detailform, ma_planung_detailform);
  ma_planung_detailform.Parent := Panel1;
  ma_planung_detailform.ma_id := Ma_ID;
  ma_planung_detailform.JahresZahl := Jahr;
  ma_planung_detailform.BorderStyle := bsNone;
  ma_planung_detailform.Left := ((Counter+1)*ma_planung_detailform.Width);
  ma_planung_detailform.Name := 'ma_detail'+IntToStr(Counter);
  ma_planung_detailform.Show;
  ma_planung_detailform.Align := alLeft;
In diesem Formular gibt es eine Query, die ich halt
gern jetzt aus meinem übergeordneten Formular ansprechen würde.

Ich steh da momentan 'n wenig auf dem Schlauch.

Moin

s.h.a.r.k 3. Mai 2010 15:19

Re: Control im dynamisch erstellten Form ansprechen
 
FindComponent kann dir da helfen.

Beispiel:
Delphi-Quellcode:
var
  btn : TButton
begin
  btn := Form1.FindComponent('Button1');
end;

stifflersmom 3. Mai 2010 15:26

Re: Control im dynamisch erstellten Form ansprechen
 
Hilft mir jetzt nicht wirklich.
Ich weiß ja, dass meine DetailForm eine Query
enthät, und ich weiß auch ihren Namen.

Da ich mein "Unterformular" allerdings mehrfach erzeuge und in einem
Panel "verframe", komme ich so nicht weiter.

Moin

himitsu 3. Mai 2010 15:41

Re: Control im dynamisch erstellten Form ansprechen
 
Dann speichere irgendwo einen Instanzzeiger auf diese Controls oder auf die Frames.
(z.B. in einer TObjectList)

stifflersmom 5. Mai 2010 07:43

Re: Control im dynamisch erstellten Form ansprechen
 
Zitat:

Zitat von himitsu
Dann speichere irgendwo einen Instanzzeiger auf diese Controls oder auf die Frames.
(z.B. in einer TObjectList)

Das war die Lösung, Danke!


Alle Zeitangaben in WEZ +1. Es ist jetzt 04:58 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz