TEdit with Validate. This is a recurrent request, I've seen it for years in many forums and for distincts languges, and I never found a satisfactory answer.
I think that must exist a component derived from TEdit with the following methods.
procedure OnEnter(Sender: TObject);
procedure OnValidate(Sender: TObject; var Ok: Boolean);
procedure OnExit(Sender: TObject);
In OnEnter Procedure, we must have a System property, which let us know if the focus is entering in this procedure caused for focus movement, or it's for re-entering after minimizing the Form or hideing it, when it recover the focus.
OnValidate Procedure, must be executed always that we do click on other object, or we press Tab, Back-Tab, Esc or Return (keys of focus movement). If we return inside this procedure the Ok variable to False, not OnEnter, OnExit, Click, etc. must be executed on this or other objects. TEdit must Delete all the events pending in the Events-Queue.
OnExit Procedure, of course, will be executed after OnValidate (if exist) and just before lost focus for Focus change of object, it may not execute for minimizing or hideing the Form.
If we can have this component with this use, for example we can change the color to green, when it receives the Focus, if there is an Error, We can show a message and the TEdit will continuing in green. Finally when the error will be correct and the user change the focus to other object, in the OnExit, we restore the initial color of it.
it will be marvellous.
There is in Delphi a link from Borland
http://bdn.borland.com/article/0,1410,16171,00.html about this, but it doesn't work with Lazarus.
Please I'd like to know your opinion.
Thanks.
Miquel
mmustaros@hotmail.com