Autor Beitrag
majolo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 334

Ubuntu 8.04, WinXP Prof.
D1, D6Pers, D7 Prof., D8 Prof., D2005 Pers
BeitragVerfasst: Fr 28.06.02 17:40 
Ich habe ein Problem bzw. eher eine Frage. In meinem Programm kann den EditFeldern eine Farbe zugewiesen werden. Nun möchte ich aber nicht immer
Edit1.Font.Color := .........
Edit2.Font.Color := ........
Edit3.Font.Color := ........
usw.
schreiben sondern das Ganze zusammenfassen. Also Beispiel
Edit[1...3].Font.color := Farbe

Mein Beispiel funzt nicht, ist auch nur ein nicht funktionierendes Beispiel.
Aber ist so etwas möglich? Ist eine Idee, die ich bisher noch nicht hatte.
Danke im vorraus.
majolo 8)
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Fr 28.06.02 17:51 
Versuch es mal so:
ausblenden Quelltext
1:
2:
3:
For Idx := 1 To 10 Do
  IF Assigned (FindComponent ('Edit' + IntToStr (Idx))) Then
    tEdit (FindComponent ('Edit' + IntToStr (Idx))).Font.Color := clBlack;


Gruß
majolo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 334

Ubuntu 8.04, WinXP Prof.
D1, D6Pers, D7 Prof., D8 Prof., D2005 Pers
BeitragVerfasst: Fr 28.06.02 18:10 
Ich kriege die Fehlermeldung Undeclared identifier: 'Idx'
Wie definiere ich IDX?
Gruß Marcus
Marc
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 169

Win 2000, Win XP, SuSE Linux 8.2

BeitragVerfasst: Fr 28.06.02 18:11 
majolo hat folgendes geschrieben:
Wie definiere ich IDX?


ausblenden Quelltext
1:
2:
Var
  Idx: Integer;


Gruß Marc
Alibi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 458

Win2K SP3
Delphi 6 Ent
BeitragVerfasst: Fr 28.06.02 18:12 
Wie jetzt? Ist doch eine ganz normale Integer Variable.
majolo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 334

Ubuntu 8.04, WinXP Prof.
D1, D6Pers, D7 Prof., D8 Prof., D2005 Pers
BeitragVerfasst: Fr 28.06.02 18:13 
Okay IDX als Integer.Die Farbe ändert sich zwar noch nicht, aber ich werde noch was probieren.
Majolo
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Fr 28.06.02 18:15 
Die Edit-Felder müssen natürlich so benannt sein wie in Deinem Beispiel oben (Edit1, Edit2, Edit3, ...)
majolo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 334

Ubuntu 8.04, WinXP Prof.
D1, D6Pers, D7 Prof., D8 Prof., D2005 Pers
BeitragVerfasst: Fr 28.06.02 18:15 
@Marc: Schon Okay. Habe ich gepennt. Fernsehen und programmieren klappt halt doch nicht immer.
Trotzdem Danke

PS: In dem Moment, wo du gepostet hast, hab ichs auch rausgefunden
majolo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 334

Ubuntu 8.04, WinXP Prof.
D1, D6Pers, D7 Prof., D8 Prof., D2005 Pers
BeitragVerfasst: Fr 28.06.02 18:18 
Danke Tino. Klappt jetzt wunderbar. Ich hatte im Programm die EditFelder anders bezeichnet.
Gruss
majolo