Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Possible bug in Lost Focus when using access keys / hot
Message
De
16/10/2002 15:48:54
Nancy Folsom
Pixel Dust Industries
Washington, États-Unis
 
 
À
16/10/2002 15:30:19
Jonathan Cochran
Alion Science and Technology
Maryland, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
00711927
Message ID:
00711936
Vues:
14
>I've noticed the following problem in VFP 6 SP3. Can someone confirm it, especially in VFP 7? If you put NODEFAULT in the LostFocus method, there should be no way for the control to lose focus, right? It appears that if you press the access key / hot key of another control, you can move focus to that control.

Yes, that's true, and how it works in 7.0. It is somewhat unexpected, I suppose, though not too surprising. The control doesn't actually lose focus, the click executes, but the focus remains on the textbox (see my example below). What you're trying to do is what the Valid() is designed for, however, and belongs in the valid.
LOCAL loForm AS FORM
loForm = NEWOBJECT('MyForm')
loForm.SHOW(1)

DEFINE CLASS MyForm AS FORM
	ADD OBJECT MyTextBox AS MyTextBox
	ADD OBJECT MyButton AS MyButton WITH TOP = 30
ENDDEFINE

DEFINE CLASS MyTextBox AS TEXTBOX

	VALUE = ""
	
	*!* Use valid instead of lostFocus
	PROCEDURE VALID
		DEBUGOUT PROGRAM() + " Value = " + THIS.VALUE
		IF EMPTY( THIS.VALUE )
			RETURN 0
		ENDIF

	ENDPROC

*!*		PROCEDURE LOSTFOCUS
*!*			DEBUGOUT PROGRAM() + " Value = " + THIS.VALUE
*!*			IF EMPTY( THIS.VALUE )
*!*				NODEFAULT
*!*			ENDIF

*!*		ENDPROC

ENDDEFINE

DEFINE CLASS MyButton AS COMMANDBUTTON

	CAPTION = "\<OK"

	PROCEDURE CLICK
		DEBUGOUT PROGRAM()
	ENDPROC

ENDDEFINE
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform