Subject When does TIB_Checkbox store its data?
Author Lukas Zeller
I have a form with a TIB_Query, a TIB_DataSource and a few TIB_Edits for
(numeric)
fields. Plus, there is one TIB_Checkbox connected as well to a field of the
TIB_Query.

Now, I want to set the TIB_Edits (for example) to disabled when the
TIB_Checkbox is checked.

However, when the Checkbox is clicked into, the check mark changes but
the change of the boolean value does not affect the connected field until
the focus
changes away from the checkbox (or the dataset is posted).

What event of what component is best for placing the enabling/disabling of
the TIB_Edits
IMMEDIATELY after changing the checkbox's status? Of course, the event
should also
be triggered when the checkbox status changes because of the TIB_Query
scrolling
to another row.

The only way I could get it to work is a rather messy combination of a
normal VCL
TCheckbox, its OnClick event, AfterScroll of TIB_Query, OnStateChanged and
OnDataChange
of the TIB_DataSource.

Is there a more elegant solution? As the example above is simplified (there
is often
more than just a single boolean field involved in the calculation of other
Control's
enabled/disabled/visible state) I would prefer an Event at the DataSource level
that is called WHENEVER a connected control causes any change to any
field.

- OnDataChange looks nice, but it triggers only after the focus changes
away from
the checkbox.
- OnStateChanged is triggered at the right TIME (when the checkbox changes its
value for the first time, and the dataset goes from dssBrowse to
dssEdit), but
of course this has nothing to do with data change.

It seems to me that TIB_Checkbox should change the underying field immediately,
and not waiting for the focus to change. In contrast to TIB_Edit, all
values that can
be input into a TIB_Checkbox are valid, so why wait for focus change?

In addition it would be very nice to have an event like
- OnControlDataChange, which would fire whenever anything in any control gets
modified (checkbox clicked, every single keystroke in TIB_Edits, not
just when
exited). As controls obviously (OnStateChange...) are notifying the
DataSource
of such changes, I guess this would not be complicated to implement?

Lukas Zeller (luz@...), Direktwahl +41 1 440 66 01 -- Synthesis
AG, Rosengartenstr. 1a, 8037 ZŸrich Tel: +41 1 440 66 00, Fax: +41 1 440 66
04 info@..., http://www.synthesis.ch