Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Keypress event vs. Valid Event
Message
De
25/07/2000 12:42:15
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00396603
Message ID:
00396659
Vues:
7
>I have several textboxes that I am using within a form that is being used for data entry.
>
>I am using the the textboxt Valid Event to run a query (if the textbox is not empty) based on the value entered in that textbox. The code is basically as follows:
>
> IF NOT EMPTY( This.value)
> rc_custno = ALLTRIM( This.Value)
> ThisForm.m_query()
> ELSE
> WAIT WINDOW "Customer # must be entered"
> ENDIF
>
>However, if I don't enter a value and decide to exit the form by using a command button set up for thisform.release(), it still runs teh valid event (ofcourse) and gives me the WAIT WINDOW message.
>
>Ideally I would want this code to fire only when I press TAB or ENTER, and I know that I should be using the KEYPRESS event or sort of it, but I can't get the syntax correct. help.
>
>Thanks,
>
>Alex

Here is another method you could try that I have found successful. Rather than putting your query code in the valid event, add a custom method to your form -- you could call it myquery. Put the code that you posted above in this method. Then, in the interactive change event for your textbox, you can put this code --

This.tag = 'a' && or anything else

Finally, in the valid event for your textbox, put something like this --

IF !EMPTY(This.tag)
ThisForm.myquery()
ENDIF

I have found this method to be successful for me. Good luck!
Dorisa Call
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform