Re: [Delphi 6] Introspection - iterate through all class members of a given type?
- From: "Richard A. DeVenezia" <radevenz@xxxxxxxxxxxxx>
- Date: Sat, 29 Oct 2005 10:15:41 -0400
Duncan McNiven wrote:
> On 28 Oct 2005 08:20:49 -0700, "Richard" <radevenz@xxxxxxxxxxxxx>
> wrote:
>
>> procedure FooBarInspector(Thing:TObject);
>> begin
>>
>> // how would I code this?
>> for each TFooBar (as aFooBar) in Thing do begin
>> doSomethingWith (aFooBar);
>> end;
>>
>> end;
>
> procedure FooBarInspector(Thing:TObject);
> var
> iCtrl : integer;
> begin
> if Thing is TForm then
> for iCtrl := 0 to TForm(Thing).ControlCount - 1 do
> if TForm(Thing).Controls[iCtrl] is TFooBar then
> doSomethingWith (TFooBar(TForm(Thing).Controls[iCtrl]));
> end;
Duncan thanks very much, this is what I needed for my situation.
Maarten thanks for making me aware of Components[], this might be needed
later :)
--
Richard A. DeVenezia
.
- References:
- Prev by Date: Re: Password Generator
- Next by Date: Drawing multiple custom controls in a metafile canvas.
- Previous by thread: Re: [Delphi 6] Introspection - iterate through all class members of a given type?
- Next by thread: Multiple modems: Threads required?
- Index(es):