Subject | Re: [IBO] InvalidateRows |
---|---|
Author | Jason Wharton |
Post date | 2003-11-07T15:08:51Z |
I think the problem is calling InvalidateRows in an OnChange event handler.
This should NOT be done.
Jason Wharton
This should NOT be done.
Jason Wharton
----- Original Message -----
From: "Gerard J.M.Houtenbos" <gh@...>
To: <IBObjects@yahoogroups.com>
Sent: Friday, July 11, 2003 5:05 AM
Subject: Re: [IBO] InvalidateRows
> I'll try to be more specific:
>
> I have a two column TwwDbGrid and a two column TIBOQuery
> (qryTest) with two float-fields.
> The OnChange-event-handler of Field1 consists of:
> {==================}
> qryTest.FieldByName('FIELD2').AsFloat := 2 *
> qryTest.FieldByName('FIELD1').AsFloat;
> qryTest.InvalidateRows;
> {==================}
>
> So the value of Field2 is filled with the value of Field1
> multiplied by 2.
>
> Back to the grid. If I change the value of the column Field1, and
> tap the Tab-key, then the value of column Field2 shows the
> correct value, so the OnChange-event-handler works fine. However,
> the record isn't posted yet. If I then change the value of the
> column Field1again an EAccessViolation shows up with the text:
> Access violation at address 0057497C in module 'Infas.exe'. Read
> of address 0000000C.
>
> If I change the value of Field1 and then POST the record, all
> works fine and I can change the value of Field1 again without any
> exceptions.
>
> tia,
>
> Gerard
>
>
> On Thu, 10 Jul 2003 13:07:00 -0700, you wrote:
>
> >> I use a TwwDbGrid and a TIBOQuery.
> >> In the OnChange-event of Field1 I change the value of Field2 that
> >> is depending on Field1.
> >> The change of Field2 is not visible in the grid.
> >> So I use a call to InvalidateRows in the OnChange-event. Then the
> >> change of Field2 is instantly visible in the grid.
> >> But when I change Field1 a second time, without posting it first,
> >> an exception is raized.
> >> How do I solve this?
> >
> >You eed to be more clear here.
> >
> >At the very least let us know what exception was raised.
> >
> >Also, I can't really tell what it is you are doing.
> >
> >Jason