Subject Re: [IBO] OnValidateFields behavior
Author Jason Wharton
Doesn't the exception prevent them from leaving the control?

What if they were in the grid and it happens to move the focus to another
control?

What do others think of this suggestion?

Thanks,
Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com


----- Original Message -----
From: "Claudio Kloss" <ckloss@...>
To: "IBObjects" <IBObjects@yahoogroups.com>
Sent: Thursday, February 22, 2001 1:35 PM
Subject: [IBO] OnValidateFields behavior


> Jason,
>
> When an exception is raised in OnValidateField after the user has pressed
> <Tab>, focus is being passed to the next control and the edit control that
> raised the exception displays the wrong value. If I <Shift><Tab>, the
value
> is displayed correctly.
>
> What do you think of calling "FocusControl" in the except block in
> "SysAfterModify"? This way locking the focus on the control that raised
the
> exception on the same way when we have required fields left null.
>
> I think the users would expect this behavior.
>
>
> procedure TIB_Column.SysAfterModify;
> begin
> if not FValidating then
> try
> FValidating := true;
> try
> if Assigned( FOnValidate ) then
> FOnValidate( Self );
> with Statement do
> if Assigned( FOnValidateField ) then
> FOnValidateField( Statement, Row, Self );
> except
> Move( FValidateBuffer^, FNewColumnInd^, DataSize +
> SizeOf(smallint));
> FocusControl; // Line included
> raise;
> end;
> finally
> FValidating := false;
> end;
> FRow.SysAfterColumnModify( Self );
> if SysInternalChanged then
> DoAfterModify;
> end;
>
> Claudio F. Kloss
> MicroLight Informática Ltda.
> Juiz de Fora - MG - Brazil