On 3/20/07, Bram Kuijvenhoven <[EMAIL PROTECTED]> wrote:


Another, more general alternative than using TComponent.Tag: use a
separate hash table that maps TObject pointers to ObjectNumbers. Unless you
really want every TObject in your whole application to have an ObjectNumber,
this approach probably consumes less memory as well. It is also flexible in
that you can map any kind of data to any set of objects just as easily, and
without burdening your class tree.

> begin
>   for C := 1 to 20 do
>   Knop[C] := TButton.Create;
>   Knop[C].ObjectNumber := C;
>   Knop[C].OnClick := @DoSomethingBright;
> end;

In can case you copy & pasted this code, I recommend to add some begin ...
end around the three lines that you want to be iterated 20 times :)


I agree it wasn't the best laid out piece of code :)
Ik zal m'n leven beteren :)

--
Ger

Reply via email to