![]() |
dynamische Labels in andere Form 'laden'-> Form1.fLabel[c
Hi.
Ich habe dynamische Bezeichner für meine Labels, welche ich mit FindComponent anspreche. In Unit1 habe ich fLabel bei den gloabalen Variablen definiert. Dinge in Unit2 wie..
Delphi-Quellcode:
funktionieren auch. Doch nun habe ich in Unit2(->Form2) eine Schleife, die Komponenten aus Form1 suchen soll und denen dann die Werte der Labels von Form2 zuweisen soll (Hier im Beispiel ein einfacher Text).
fLabel[gez] := TLabel(FindComponent('name' + IntToStr(gez)));
fLabel[gez].Caption := 'test';
Delphi-Quellcode:
Ich hoffe es ist erstmal richtig, dass ich fLabel in Unit1(der Haupt Unit) deklariert habe bei den globalen variablen. Hatte es auch schon bei Public, aber ging nich so ganz.
for cbv:=1 to 5 do
begin fCheckBox[cbv] := TCheckBox(FindComponent('CheckBoxKT' + IntToStr(cbv+100))); if fCheckBox[cbv].Checked = true then begin Hauptform.fLabel[cbv] := TLabel(FindComponent('meatkpt' + IntToStr(cbv+100))); Hauptform.fLabel[cbv].Caption := 'testtext bzw. Daten aus Labels von Form2'; end; end; Das eigentliche Problem ist nun eigentlich, dass es anscheinend nicht die Labels aus Form1 findet. Ich hoffe mein Beitrag is verständlich und dass mir jemand helfen kann. Gruß colo |
Re: dynamische Labels in andere Form 'laden'-> Form1.fLab
hallo colo,
verwende
Delphi-Quellcode:
mit Deinem Code findest du nur die Komponenten von TForm2.
TForm1.FindComponent
Roderich |
Re: dynamische Labels in andere Form 'laden'-> Form1.fLab
sorry, zu schnell getippt... :roll:
natürlich
Delphi-Quellcode:
ohne das 'T' vorn
Form1.FindComponent
Gruß Roderich |
Re: dynamische Labels in andere Form 'laden'-> Form1.fLab
Vielen Dank. Funktioniert ;)
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 22:59 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz