i'm not sure this qualifies as "cleaner" - but something
like...
type TPeekTDataSource = class(TDataSource);
// shameless hack
procedure FindFoo( d:TDataSource; foo : TClass ); var i:integer; lk:TDataLink; begin // find all
the controls of class foo that have Datasource property
// set to
d
for i := 0 to TPeekTDataSource(d).DataLinks.Count-1 do begin lk := TPeekTDataSource(d).DataLinks[i]; if not (lk is TFieldDataLink) then continue; if not (TFieldDataLink( lk ).Control is foo) then continue; // found
one
ShowMessage ( TFieldDataLink( lk ).Control.Name ); end; end;
|
Title: Message
- [DUG]: Finding the controls bound to a datasource Stacey Verner
- RE: [DUG]: Finding the controls bound to a datasour... Nello Sestini
- RE: [DUG]: Finding the controls bound to a datasour... Myles Penlington
- Re: [DUG]: Finding the controls bound to a data... Nello Sestini