Subject Re: [IBO] Re: ColorScheme details - OnDelete
Author Paul Vinkenoog
Hello Ryan,

> No way!
> Not with over 100 DB enabled forms...

Besides, if you find TIB_Edits on the forms, you'd still have to check
their DataSource->Dataset to see if it's the same as the Dataset upon
which the OnDelete handler is called. That's wading through hundreds
or thousands of controls to find just a few.

But you can also find your TIB_Edits like this (in pseudocode):

for 0 <= i < IB_Dataset.DataSourceCount
DS = IB_Dataset.DataSources[ i ];
for 0 <= j < DS.DataLinkCount
DL = DS.DataLinkList.Items[ j ];
if DL is TIB_ControlDataLink and DL.Control is TIB_Edit
//
// maybe check visibility or so, and paint it red
// you might need to call ProcessMessages too
//
endif
endfor
endfor

You don't get any slack here, except maybe a little in the innermost
loop. Other than that, you zoom in right on what you're looking for.

*Snag*
Unfortunately, TIB_DataSource.DataLinkList is protected
(unlike DataLinkCount).

Solution: either open IBA_DataSource.INT and move the line
"property DataLinkList: TList read FDataLinkList;"
from the protected to the public part, and rebuild IBO...

...or make a subclass surfacing DataLinkList (no need to rebuild
IBO, but if you upgrade IBO you may need to rebuild your subclass).


Actually, I wonder why DataLinkList is protected. Why not make it
public? It can be very useful to be able to trace the controls that
are linked to a certain Dataset or DataSource. And after all,
DataLinkCount is public too.


> I will follow Jason's suggestion,
> and lose myself in that wonderful forest called IBO Source!

Brave guy. If you die in the attempt, we'll name a component after
you! :-)


Greetings,
Paul Vinkenoog