Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
KEYPRESS - EVENT (Trapping Alt or Ctrl)
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00121615
Message ID:
00122101
Views:
15
Here's an example that traps the Alt-F combo (which normaly brings up the File menu). When textbox1 has focus, the key is trapped and it's background is changed to red. When it loses focus, the Alt-F resumes it's normal behavior. This should work for Ctrl combinations as well.
PUBLIC oform1

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

DEFINE CLASS form1 AS form

	Name = "Form1"

	ADD OBJECT text1 AS textbox WITH ;
		Left = 36, ;
		Top = 60, ;
		Name = "Text1"

	ADD OBJECT text2 AS textbox WITH ;
		Left = 36, ;
		Top = 108, ;
		Name = "Text2"

	PROCEDURE text1.GotFocus
		on key label alt+f _screen.activeform.activecontrol.backcolor = rgb(255,0,0)
	ENDPROC

	PROCEDURE text1.LostFocus
		on key label alt+f
	ENDPROC

ENDDEFINE
kenweber
GCom2 Solutions
Microsoft Certified Professional

Previous
Next
Reply
Map
View

Click here to load this message in the networking platform