Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ON KEY LABEL command problem
Message
De
15/07/2014 00:16:07
 
 
À
14/07/2014 23:49:44
Yim Ming Sun Derek
Spacious Design Consultant
Hong Kong, Hong Kong
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01603678
Message ID:
01603680
Vues:
63
>Hi,
>I want user to press the HOME key to set focus to the first edit box control in the form.
>
>The following code not work.
>
>
>ON KEY LABEL HOME thisform.txtCusno.SetFocus()
>
You don't say what the error is (if any). I suspect ThisForm is not available in the context of ON KEY LABEL. The help for that command says "Note that ON KEY LABEL operates outside of the scope of a form; the KeyPress event can be used within forms to execute code when a key is pressed."

KeyPress/KeyPreview are the preferred way to do this sort of thing. In your case you would:

- set the Form's .KeyPreview property to .T.

- in the Form's .KeyPress( ) method have code like this:
LPARAMETERS nKeyCode, nShiftAltCtrl

IF nKeyCode = 1
	NODEFAULT
	
	This.txtcusno.SetFocus( )

ENDIF
Further information at http://fox.wikis.com/wc.dll?Wiki~KeyPress~WIN_COM_API .
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform