A while ago I was asked by a friend if it would be possible to clone harbour VALID functionality in hmg4.
At first I was contrary since it is against GUI standards... you can't be forced on a field if there are other active fields on the form.
Then he convinced me saying that also my harbour text-mode code heavily relies on VALIDs and their side-effect (f.e. record pointer moves).

It is not easy to do in Qt, just because it is not standard GUI behaviour ! And Qt doesn't ask "I want to leave the object, can I ?" It just moves the focus and generates events and signals...

Well, I must advise you that using the HMG3 way to use :setFocus() inside a onLostFocus event may not work in HMG4 ! :setFocus() can't be used safely in the lost focus event.

So I used a little trick: keep record of the object losing focus with a VALID not true and on the onGotFocus of the next textbox check if we must give focus back to someone else...

Up to now it seems to work in a very simple, little test, with only a widget in the form with a VALID... The test must be expanded to accomodate several other complex situations... (I already know that current code can fail in some cases...)

This commit is also important for other points:
- started using of HB_TRACE for helping debugging... this is absolutely transparent to library users since the trace must be enabled during library compilation...
- started to add some docs in the code to explain what that code does... too much time spent to guess what a piece of code written a month ago actually does...
- introduced calling a code block nested in a WITH OBJECT Self

Using EVAL we lose the calling object. If you look at the example above in the remmed onValid I have to specify the variable name... it's ok, of course.... in the second sample we retrieve the current object with hb_QWith()... probably I could have used the new methods introduced by Luigi to know the current object, but I wrote the code before his commits...

I still think that hard valids are not GUI standard and they are BAD... I know that committed code needs to be updated for handling more complex cases... I already know how to visually signal that a textbox has invalid value (via css selectors - great Qt power !!!)