Subject Re: [IBO] Detecting user changes
Author Shane van de Vorstenbosch
In my particular application, I require an event every time the control
changes. I can understand why the underlying data is not changed until the
user exits the control, but I want to be able to update another control on
every change entered.

For example, if a progress bar type of control was associated with the
field, it would be good to be able to update it immediately as the value is
being changed (ie as the user pushes the +/- buttons or enters a value).

I am displaying two associated values. One is the raw value and this is what
is stored in the database. The other is the temperature and this is
converted from the raw value into celcius or farenheit. As the raw value is
changed I would like to the calculated temperature change immediately.

BR
Shane
----- Original Message -----
From: "Geoff Worboys" <geoff@...>
To: <IBObjects@egroups.com>
Sent: Friday, January 05, 2001 1:54 PM
Subject: Re: [IBO] Detecting user changes


> > It appears that the TIB_SpinEditEnh does not trigger events
> > as expected.
> <...>
>
> Is this any different to normal edit controls? OnDataChange will fire
> when a field value is updated. Controls only update the underlying
> field value when...
>
> - the user exits the control
> - the dataset is posted
> - the user presses enter (in Edit controls)
>
> AFAICT this is the only practical way to implement this, since it is
> possible that a controls contents may be temporarily invalid during
> data entry (the value may be incomplete).
>
> I suggested attaching to OnDataChange because your previous posting
> implied you wanted to detect field level changes. OnDataChange will
> find such changes regardless of whether they come from controls, grids
> or code updates.
>
> If you really want to attach code to changes in a particular control
> (as opposed to changes to the field itself) then you will need to
> attach to the OnChange event of the control. You can still test the
> associated dataset edit state to see if you want the particular
> change. Of course by using OnChange you still run across the problem
> of partial inputs being incomplete and so invalid. So....
>
> I guess SpinEdit is a slightly different beast in that clicking the
> up/down arrows applies a new value "in full", and so it is unlikely
> that such a value is invalid. You could attach code to the OnButton1
> and OnButton2 event handlers (which are called immediately after the
> increment/decrement is applied).
>
> Of course the problem then is how to tell the control to commit its
> change to the field buffer - and so force your DataSource.OnDataChange
> to fire with appropriate field values. This could be forced by
> sending a VK_RETURN keystroke to the control but this sort of thing
> gets rather ugly. There are probably some things you could do to the
> dataset/datasource but these are also less than elegant.
>
>
> Jason, is there any reason why we cannot make a control's DataLink
> public? This would allow (in the above situation) an event handler to
> call...
> IB_Edit1.DataLink.UpdateData;
>
> Alternatively we should make an equivalent function available on the
> controls themselves to perform this function.
>
>
> I might stop rambling now. I guess the question is...
>
> Shane, do you think that the ability to specifically call UpdateData
> (to force the field update) may give you what you need? Or perhaps I
> have lost the point somewhere (it would not be the first time :-)
>
>
> Geoff Worboys
> Telesis Computing
>
>
>
>