Title: Message
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;
 
 
 
----- Original Message -----
Sent: Thursday, 29 August 2002 11:01
Subject: [DUG]: Finding the controls bound to a datasource

Is there any way of enumerating the edit controls bound to a particular datasource or dataset?
 
I can go through the list of controls owned by the form and find those that have a datasource property set to the datasource I care about, but I would like a cleaner method.
 
Stacey
 
Stacey Verner             Ph:   +64-9-4154790
Software Developer        Fax:  +64-9-4154791
                          DDI:  +64-9-4154797
CJN Technologies Ltd.     Email:
[EMAIL PROTECTED]
PO Box 302-278, North Harbour, Auckland 1330, New Zealand
12 Piermark Drive, North Harbour, Auckland, New Zealand
Visit our website at
http://www.cjntech.co.nz/
 

Reply via email to