Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BindEvent Question
Message
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
00978683
Message ID:
00978918
Views:
26
>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--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform