<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 10.10.2015 12:30, Michael Van
Canneyt wrote:<br>
</div>
<blockquote
cite="mid:alpine.DEB.2.10.1510101225370.13464@home.telenet.be"
type="cite">
After a
<br>
<br>
sed s/iterator/enumerator/g
<br>
<br>
I'm all for it.
<br>
<br>
I've been looking how to implement names/objects/values
enumerators in TStrings. This would be the almost perfect
solution.
<br>
<br>
But your example is not well-chosen, since the enumerator for
TComponent already exists:
<br>
<br>
Procedure TForm1.Button1Click(Sender: TObject);
<br>
var
<br>
Comp: TComponent;
<br>
begin
<br>
for Comp in Self do
<br>
//...
<br>
end;
<br>
<br>
Just as an aside...<br>
</blockquote>
<br>
Yes, of course. I ment enumerator :)<br>
<br>
<tt> TTest = class</tt><tt><br>
</tt><tt> // ...</tt><tt><br>
</tt><tt> property Objects[Index: Integer]: TObject read
GetObject <b>enumerator GetObjectEnumerator</b>;</tt><tt><br>
</tt><tt> property ObjectCount: Integer read GetObjectCount;</tt><tt><br>
</tt><tt> end;</tt><tt><br>
</tt><br>
<br>
+ Yes, the "in Self" is supported. But this is not the problem here.
The example still doesn't compile. A class can have more array
properties. And even the default class enumerators can be redeclared
and so hide enumerators from ancestor classes.<br>
<br>
Maybe a better example:<br>
<br>
<tt><b>Procedure TForm1.Button1Click(Sender: TObject);
</b></tt><tt><b><br>
</b></tt><tt><b>
var
</b></tt><tt><b><br>
</b></tt><tt><b>
Cont: TControl;
</b></tt><tt><b><br>
</b></tt><tt><b>
begin
</b></tt><tt><b><br>
</b></tt><tt><b>
for Cont in Controls do
</b></tt><tt><b><br>
</b></tt><tt><b>
//...
</b></tt><tt><b><br>
</b></tt><tt><b>
end;
</b></tt><tt><b><br>
</b></tt><tt><b>
</b></tt><br>
Ondrej<br>
</body>
</html>