Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
BindEvent Question
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Divers
Thread ID:
00978683
Message ID:
00978918
Vues:
24
>I have the keypress event in several text box controls bound to a method on a parent container. The delegate event fires if I press a key solo or if "SHIFT" plus the key is pressed. "CTRL" plus the key does not fire the delegate event. I didn't try "ALT" plus the key because I've got that particular combination defined as a hot key.
>
Hi Jim,

Run code below and see if CTRL+Key still doesn't work. It works for me but keep in mind that not all CTRL+Key combinations will trigger Keypress event because thay could be assigned as menu hot keys, reserved by Windows or other reasons.
PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
RETURN

DEFINE CLASS form1 AS form

	DoCreate = .T.
	Caption = "Form1"
	Name = "Form1"

	ADD OBJECT text1 AS textbox WITH ;
		Height = 23, ;
		Left = 48, ;
		Top = 84, ;
		Width = 100, ;
		Name = "Text1"

	ADD OBJECT text2 AS textbox WITH ;
		Height = 23, ;
		Left = 216, ;
		Top = 84, ;
		Width = 100, ;
		Name = "Text2"

	PROCEDURE onkeypress
		LPARAMETERS nKeyCode, nShiftAltCtrl

		DEBUGOUT PROGRAM(), nKeyCode, nShiftAltCtrl
	ENDPROC

	PROCEDURE Init
		BINDEVENT(Thisform.Text1, "KeyPress", Thisform, "OnKeyPress")
		BINDEVENT(Thisform.Text2, "KeyPress", Thisform, "OnKeyPress")
	ENDPROC

	PROCEDURE text1.KeyPress
		LPARAMETERS nKeyCode, nShiftAltCtrl
		DEBUGOUT PROGRAM(), nKeyCode, nShiftAltCtrl
	ENDPROC

	PROCEDURE text2.KeyPress
		LPARAMETERS nKeyCode, nShiftAltCtrl
		DEBUGOUT PROGRAM(), nKeyCode, nShiftAltCtrl
	ENDPROC

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

Click here to load this message in the networking platform