Re: [Delphi 6] Introspection - iterate through all class members of a given type?
- From: Duncan McNiven <spamtrap@xxxxxxxxxxxxxxxxxx>
- Date: Fri, 28 Oct 2005 20:02:20 +0300
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
.
- Follow-Ups:
- Re: [Delphi 6] Introspection - iterate through all class members of a given type?
- From: Richard A. DeVenezia
- Re: [Delphi 6] Introspection - iterate through all class members of a given type?
- References:
- Prev by Date: Re: Table does not reflect any changes
- Next by Date: Multiple modems: Threads required?
- Previous by thread: [Delphi 6] Introspection - iterate through all class members of a given type?
- Next by thread: Re: [Delphi 6] Introspection - iterate through all class members of a given type?
- Index(es):