Autor Beitrag
lenny Whatever
Hält's aus hier
Beiträge: 11



BeitragVerfasst: Fr 04.05.07 12:17 
In uniface (horrible language) you can use indirection to simplify reppetitions. Dephified it would look like something like this:

ausblenden Delphi-Quelltext
1:
for count := 1 to 10 do @edit[count].text := 1;					


in Delphi I curretly do

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
edit1.text := 1;
edit2.text := 1;
edit3.text := 1;
edit4.text := 1;
edit5.text := 1;
edit6.text := 1;
edit7.text := 1;
edit8.text := 1;
edit9.text := 1;
edit10.text := 1;


Can anyone think of a way to reduce that chunk of code into something less space consuming.

thanks

Lenny

Moderiert von user profile iconKlabautermann: Delphi-Tags hinzugefügt.
Miri
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 657


Delphi 3 Prof., Delphi 2005 PE
BeitragVerfasst: Fr 04.05.07 12:19 
Suche in der Entwickler-Ecke FINDCOMPONENT might help you!

_________________
Anonymes Eckenkind
lenny Whatever Threadstarter
Hält's aus hier
Beiträge: 11



BeitragVerfasst: Fr 04.05.07 12:40 
Thanks Miri

var
I : integer;
begin
for i := 1 to 10 do
begin
(FindComponent('edit' + inttostr(i)) as Tedit).text := '1';
end;
end;