Subject | OnValidateFields behavior |
---|---|
Author | Claudio Kloss |
Post date | 2001-02-22T20:35:03Z |
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
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