Subject ValidateField causes infinite loop
Author mircostange
I encoutered a problem when using ValidateField with the grid
control. To ensure, input for certain fields is within valid range, I
have written a validation procedure as below:

procedure TProPXViewReferenceRanges.queryValidateField(
Sender: TIB_Statement; ARow: TIB_Row; AField: TIB_Column);
begin
inherited;
if (aField.fieldName = 'AGE_YEAR' ) then begin
if (aField.asInt64<0) or (aField.asInt64 > 200) then raise
exception.create(localizeString('$outOfRange')+' 0-200');
end else if (aField.fieldName = 'AGE_MONTH' ) then begin
if (aField.asInt64<0) or (aField.asInt64 > 200) then raise
exception.create(localizeString('$outOfRange')+' 0-200');
end else if (aField.fieldName = 'AGE_DAY' ) then begin
if (aField.asInt64<0) or (aField.asInt64 > 2000) then raise
exception.create(localizeString('$outOfRange')+' 0-2000');
end;
end;

Editing happens in a grid control bound to the query. Everything
works fine so far. When I enter invalid values and proceed with TAB
or other keys, I receive the error message and the edit box remains
activated.

However, when I click into the non-row area of the grid (there is
some space between the last row and the bottom of the grid) I also
reveice the error message --- but it occurs over and over again.

Any ideas?