Autor Beitrag
beljo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 129



BeitragVerfasst: Di 14.03.06 13:19 
hallo Leute,
also ohne eure Tatkräftige unterstützung hätte ich bestimmt schon die Flinte ins Korn geworfen.
Mein Problem Heute.
Ich möchte alle Textfelder von beginn an neu besetzten.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.FormCreate(Sender: TObject);
begin
     TEdit.text:='0';
end;

So funktioniert es nicht, ich möchte nicht immer edit1.text und etit2,text usw Aufschreiben
kann mir jemand helfen?


Moderiert von user profile iconChristian S.: Topic aus Delphi Language (Object-Pascal) / CLX verschoben am Di 14.03.2006 um 12:35
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Di 14.03.06 13:35 
Hallo!

Die Suche nach Suche in: Delphi-Forum, Delphi-Library FINDCOMPONENT sollte Dir weiterhelfen :-)

Grüße
Christian

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
cherry
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 136

WinXP - Professional
RAD Studio 2009
BeitragVerfasst: Di 14.03.06 13:46 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
for i := 1 to ComponentCount -1 do
begin
 if (Components[i] is TEdit) then
 begin
  (Components[i] as TEdit).Clear {Inhalt löschen}
  // (Components[i] as TEdit).Text := '0' {Inhalt auf setzen!}
 end;
end;

_________________
AM I TOO SEXY?
Ist das nur mein Gefühl, oder ist die ganze Welt verrückt geworden!?
Hux
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 171



BeitragVerfasst: Di 14.03.06 13:51 
so isses irgendwie leichter...
ausblenden Delphi-Quelltext
1:
2:
3:
for i:=1 to Component.Count-1 do begin
TRichEdit(findcomponent('RichEdit'+IntToStr(i))).Clear;
end;


Also des is eigentlich des gleiche was cherry geschrieben hat...
beljo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 129



BeitragVerfasst: Di 14.03.06 16:13 
Danke Leute,
habt mir mal wieder viel Schreibkram erspart
cherry
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 136

WinXP - Professional
RAD Studio 2009
BeitragVerfasst: Mi 15.03.06 10:59 
user profile iconHux hat folgendes geschrieben:
so isses irgendwie leichter...


Naja nicht ganz!
Angenommen du willst mehrere Eigenschaften der Komponente ändern,
geht dies schneller!

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
for i := 1 to ComponentCount -1 do  
begin  
 if (Components[i] is TEdit) then  
 begin  
  (Components[i] as TEdit).Clear
  (Components[i] as TEdit).Color := clAqua;
  (Components[i] as TEdit).ReadOnly := true;
  {...}
 end;  
end;


Ist vom handling her irgendwie einfacher, die
Komponente muss nur einmal "gesucht" werden!

_________________
AM I TOO SEXY?
Ist das nur mein Gefühl, oder ist die ganze Welt verrückt geworden!?