Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
LostFocus vs. Valid in Comboboxes
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00264458
Message ID:
00265111
Vues:
29
>Kile,
>
>The solution to this problem is really pretty easy when you see it. Valid determines if focus will ba allowed to elave or not through its return value. If the Valid says it is ok to leave then LostFocus decides where to go (setfocus).
>

That was how I thought Valid() worked, but I couldn't get it to do anything for me in my ComboBox. I read somewhere here on the UT (or maybe it was in the Hacker's Guide...) that Valid() didn't work normally for Combo/ListBoxes. This is why I tried (and failed!) to solve my problem using the InteractiveChange/LostFocus/SetFocus methods.

>The only gotcha there is is that you must know that LostFocus does an implicit SetFocus after your code runs to set focus to the next control in the tab order, whihc, of course, will over ride yours. When this happens it looks like your SetFocus didn't work, but, in fact, it did. it is just that after focus went where you told it to go, the implicit one moved focus to where it wanted to go.
>
>The solution is, if you SetFocus in a LostFocus you must also issue a NODEFAULT to prevent the implicit SetFocus from occuring.

Jim you're absolutely right! I replaced the many lines of code I had used as a patch to this problem, entered your one-liner, and it works perfectly!

I had originally thought that for an object, if nothing was entered in the code section of a method, DODEFAULT() was automatic. However, if you entered code, (or even blank spaces), anytime that method was fired it would only do exactly what was in the code section of that method, unless you added an explicit DODEFAULT() in addition to your added code.

Now my application works perfectly, and I understand even less about the fireing of events within an object's method.

(manoman have I got a lot to learn... :-)

Thanks for your help Jim!
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform