Subject Re: [IBO] Validating a field
Author Helen Borrie
At 08:03 PM 14/09/2005 +0000, you wrote:
>I need some help on how to validate a field with IBO.
>Before using IBO, I did it this way:
>1) right-button click the Query object on DataModule and choose Fields
>2) select a field and double-click on its OnValidate event
>3) write code to test some conditions
>I am using a TIB_Grid linked to a TIB_DataSource and a TIB_Query.
>The user can type values for the fields on the TIB_Grid and I need to
>validate it. But I couldn't yet figure out how to do this kind of
>validation with IBO. I couldn't find it on IBObjects Home Page FAQ.

It's not so different; except in IBO you can code all of your fields
validations in one handler. OnValidateFields fires and OnValidateField
event for each field in the row. Click on the OnValidateFields member in
the Object Inspector's Events list and you will get this template:

procedure TForm1.IB_Query1ValidateField(Sender: TIB_Statement;
ARow: TIB_Row; AField: TIB_Column);


ARow is the current Fields[] array, through which you can access individual
fields using the ByName method; or you can test for each individual field
through the AField property, e.g.

with AField do begin
if Name = 'SomeField' then
else ..........