Subject | Re: [IBO] Using OnValidateField? |
---|---|
Author | Jason Wharton |
Post date | 2008-07-15T16:29:41Z |
Paul,
I'm not sure how you can work around this as I don't know the whole
picture. What are you calling on OnValidateField? If you are
calling Cancel there then this would be a problem. It's only job is
to do nothing or raise an exception. The exception should be
handled in the code where Post is called.
If something comes up when OnValidateField is called that indicates
the edits to the record should be cancelled then it should set a
flag variable to indicate this. Then, you could put exception
handling around your call to post to check and see if the indicator
to cancel was flagged and if so then it would go ahead and call
Cancel.
Does this help?
Jason
I'm not sure how you can work around this as I don't know the whole
picture. What are you calling on OnValidateField? If you are
calling Cancel there then this would be a problem. It's only job is
to do nothing or raise an exception. The exception should be
handled in the code where Post is called.
If something comes up when OnValidateField is called that indicates
the edits to the record should be cancelled then it should set a
flag variable to indicate this. Then, you could put exception
handling around your call to post to check and see if the indicator
to cancel was flagged and if so then it would go ahead and call
Cancel.
Does this help?
Jason
--- In IBObjects@yahoogroups.com, "Paul Hope" <paulhope@...> wrote:
>
> I'm using OnValidateField for a TIB_Query connected to a
TIB_Grid.
> The grid has only 1 line of data.
> I put in a bad value and click the OK button which calls 'if
> query.needtopost then query.post'
> The error is displayed and the value in the grid returns to its
original
> value.
> Clicking OK again raises the error again even thought the grid is
showing
> the old (acceptable) value.
> The only way to get out is to press Esc, which doesnt change
anything
> visually (including the indicator column), then click OK again.
>
> This is very confusing for the user.
>
> I could post a message in OnValidateField handler which calls
query.cancel
> but this seems somewhat cumbersome.
>
> Is there a better way of doing this?
>
> Regards
> Paul
>
>
> [Non-text portions of this message have been removed]
>