Subject Re: [IBO] Focus of TIB_Datasource
Author Christian G├╝tter
Hi Helen,

> Won't the OnGainFocus and OnLoseFocus events of the datasource work for you?

It is not very convenient to use these events because I am using many
datasources on my form. So it would have been nice to have a general
OnDataSourceFocusChanged event in the session object.

As a workaround, I have done the following: in the constructor of the
base class for my forms, I iterate through all my datasources (which
are used on the form) and assign one an the same procedure to the OnGainFocus
event. In this procedure, I wrote the code which does the stuff I want
to do for all my datasources when they gain the focus.

Sometimes, I have to use the OnGainFocus event in forms derived from
my base class. Then I override the GainFocus procedure of the base
class, call 'inherited' an then do stuff for specific datasources:

if DataSource = dsFoo then
begin
[...]
end
if DataSource = dsBar then
...

This works quite fine for me.


Christian