Subject Re: [IBO] Re: IB_EditEnh. Own error handling, how ?
Author Geoff Worboys
Sándor,

> 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.

This error is not coming from EditEnh (you are not using the DateTime
editor from the EnhComponents pack?) So intercepting OnValidateError
wont help in this instance (by default EditEnh can only validate
against the supplied mask). I expect this error must be coming from
the string-to-datetime conversion at the column level, which
presumably makes it a VCL message.

I do have an update that I have not distributed yet which adds the
following event handler...

property OnValidateEdit: TEditEnhValidateEditEvent;

{: Event occurs just prior to the default validation
processing (on exit of control, or press of return key).
Either process the contents of the control to make it valid,
ready for default validation, or set the IsValid parameter
to false to indicate that the value is not valid (skipping
the default validation and raising the ValidateError event).}


This would allow you to attach extended validation processing that
could check the datetime conversion before it gets to the column
assignment. Note that the new version of CustomEditEnh also makes it
so that Validate is called whether a mask is defined or not, allowing
you to attach code to this event for special processing even if no
mask is defined.


This change is part of a widespread set of changes that I was
preparing to accompany IBOv4. If your need is urgent I can see about
making this event available earlier - if it can wait you will save me
some work :-)


Geoff Worboys
Telesis Computing