Subject Re: [IBO] FocusControl?
Author Helen Borrie
At 05:31 PM 29/06/2004 +0200, you wrote:
>hello Helen,
>
> > What do you want to do? The TIB_Dataset already calls
> > this method itself during the CheckRequiredFields period
> > of BeforePost.
>
>yes, of course, but in the on before post event of the query I'm doing some
>extra checks on some fields, and if something is wrong I'd like to focus
>the associated control:
[..]
Try doing it this way:

> if Something wrong then

begin
TmpFld.FocusControl;
> raise EBadValueError.Create('The value is bad')

end

> end;
> .....
> except
> on E: EBadValueError do
> begin
> //TmpFld.FocusControl;
> raise
> end
> end
> end
>end;
>
>The problem is that TmpFld.FocusControl does nothing. But maybe it's not
>the correct usage?

It seems to make more sense to follow Jason's usage and call FocusControl
*before* raising the exception.

Helen