Subject Re: Only one Lookup-Query for several different Datasets
Author Marco Menardi <mmenaz@lycosmail.com>
mmm, I think that you can try the OnDataChange of the datasource, with
code like this (pasted from a program of mine):
...
if qryMovConRighe.State in [dssEdit, dssInsert] then
begin
if (Assigned(Field) and ((Field.FieldName = 'DARE') or
(Field.FieldName = 'AVERE')) or (Field = nil) ) then
begin
// do yourwork here
end;
end;
...

if this does not work, you can try the OnValidateField of the dataset.
This sort of interactive feedback is a nightmare in windows. At the
time of the above code, IBO had a "bug" so if you use a IB_CtrlGrid,
if you insert a new value in the last field and press TAB, the
datachange event is called only one time (instead of twice, one for
the field new value, one for the new row) with Field=nill. You have to
test it with the last version since maybe that code should be refined.
regards
Marco Menardi


--- In IBObjects@yahoogroups.com, "Florian Hector" <FHector@w...> wrote:
> Marco,
>
> thanks very much, works perfectly.
>
> One more question:
> When a dataset is in insert or edit state, how can I react upon
insertion or
> change of a value of a specific column?
> What I want to do is this:
> After the user has selected an article and how many of them, I want
to call
> a stored procedure to find the price for this combination (for example 1
> costs $ 2,00, 2-5 costs $ 1,90 each ...) and insert it into the grid.
>
> Florian