Subject | Re: IB_EditEnh. Own error handling, how ? |
---|---|
Author | Sándor Nagy |
Post date | 2000-12-14T16:28:42Z |
Madame Lavoie,
Thank you for your answer.
The problem is that if there are no mask errors, we can not catch
the OnValidateError.
For example 2000.33.44 is good for mask 0000/00/00/ but it's a
wrong date, so I will get the
"2000.33.44 is not a vaild date and time"
message, before I leave the field or try to post.
I can't avoid this English message on a nice way.
The only (ugly)solution what I find yet is that I check the date field
on the relation EditEnh's OnExit event, if it's invalid date I show
my own message and call Abort.
I had to do this on the UpdateBar's BeforeAction event also if
the IB_UpdateBar1.FocusedButton = ubPost.
Thx
Sándor
Thank you for your answer.
The problem is that if there are no mask errors, we can not catch
the OnValidateError.
For example 2000.33.44 is good for mask 0000/00/00/ but it's a
wrong date, so I will get the
"2000.33.44 is not a vaild date and time"
message, before I leave the field or try to post.
I can't avoid this English message on a nice way.
The only (ugly)solution what I find yet is that I check the date field
on the relation EditEnh's OnExit event, if it's invalid date I show
my own message and call Abort.
I had to do this on the UpdateBar's BeforeAction event also if
the IB_UpdateBar1.FocusedButton = ubPost.
Thx
Sándor
--- In IBObjects@egroups.com, "Rita Lavoie" <rita.lavoie@c...> wrote:
> Monsieur Nagy,
>
> You may try this.
>
> There are five error messages that can be generated;
>
> {: Validation Error Code: Insert/Replace character invalid for
position.}
> E_MASKENH_CHAR_INVALID = 1;
> {: Validation Error Code: Input string was too long for mask.}
> E_MASKENH_TRUNCATED = 2;
> {: Validation Error Code: Input string does not fit mask
requirements.}
> E_MASKENH_INVALID = 3;
> {: Validation Error Code: Input string was truncated, or some
characters
> ignored due to invalid mask match.}
> E_MASKENH_INVALIDTRUNC = 4;
> {: Validation Error Code: Insert/Replace attempted beyond end of
mask.}
> E_MASKENH_CHAR_TRUNCATED = 5;
>
>
> If you wish to override the Exception Error Code than go as
follows :
>
> procedure TYourForm.EditZipCodeValidateError(Sender:
> TObject;//ValidationError
> ErrCode: Integer; var RaiseExc: Boolean);
> begin
> case ErrCode of
> 1:
> begin
> if (Sender = EditZipCode) then ShowMessage('Invalide
ZipCode etc.');
> end;
> 2:
> 3:
> 4:
> 5:
> end;
> RaiseExc := False;
> end;
>
>
> Rita
>
> ----- Message d'origine -----
> De : "Sándor Nagy" <nagy.sandor@s...>
> À : <IBObjects@egroups.com>
> Envoyé : 14 déc. 2000 05:42
> Objet : [IBO] IB_EditEnh. Own error handling, how ?
>
>
> > HI,
> >
> > I have a form with many fields, there are some date fields on it
also.
> > I can not switch off the built in error handling in the IB_EditEnh
> > component. I don't want to get the English message if the filled
> > date is invalid, and I have to make some other chekings (range
cheks)
> > on every date field.
> > How can I disable the built in error handling in IB_EditEnh ?
> >
> > " OnValidateError -> RaiseExc := False; " doesn't works.
> >
> > I tried to catch the errors on the IB_Query s BeforePost event.
> > I made my own error handling (try-except) code there.
> > Maybe on wrong place ?
> >
> > Thx
> >
> > Alex
> >
> >
> >
> >
> >