Subject Again on FocusControl
Author Salvatore Besso
hello all,

second post.

well, TIB_Column.FocusControl is really getting me crazy. The application
is still under early development and what I have obtained now is that the
two forms of which I spoke in my previous threads have still FocusControl
not working properly (the control is not focused at all), while in a new
form that I have just built from scratch (far more complicated than the
others though) FocusControl works fine!

What I have to say is that all the three forms use the same event handler
(TIB_Query.OnBeforePost) to perform field validation and call FocusControl
when needed. The only difference is explained below:

Not working forms:

Fields are validated by means of a for loop cycling IB_Dataset.Fields
(IB_Dataset is the parameter supplied by the event) and assigning it to
TmpFld at every loop cycle. This is done because fields to validate are
several. Here TmpFld.FocusControl doesn't work and the desired control is
not focused.

Working form:

Here there is only one field to validate and so I have directly assigned
(without any loop) IB_Dataset.FieldByName('FIELD_NAME') to TmpFld. Yes, I
know, I could have not used TmpFld and could have worked directly with
IB_Dataset.FieldByName, but it's not that important. Well, here
TmpFld.FocusControl works like a charme and the focus is transferred to the
correct control when requested to do so.

I have also tried to copy and paste the working TIB_Query in not working
data module restoring the correct SQL and other needed parameters but with
no luck.

Why?

Could it be some data aware control setting in not working form to cause
the problem or does FocusControl depend by something else?

Regards
Salvatore