Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem in keypress event
Message
From
29/04/2008 12:09:32
Peter Wagner
Point Informática Ltda.
Limeira, Brazil
 
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Database:
MS SQL Server
Miscellaneous
Thread ID:
01313639
Message ID:
01313897
Views:
9
Sergey, thanks for the advice!
I will try to solve it with bindevents.

Peter


>Run code below and you'll see that Sfift+1 - Shift+9 work fine on main keyboard. Shift+6 may not work in your application because it generates the same key code as Ctrl+F1. If Ctrl+F1 is used as menu shortcut, it'll take precedence over Shift+6.
>For numeric key pad Shift key flips status of NumLock key. The digit 5 does not have any function assigned when NumLock is off so it does not genearte any code in combination with Shift. You may want to look into binding to Windows events with Bindevent to solve the problem.
>
>
>PUBLIC oform1
>
>oform1=NEWOBJECT("form1")
>oform1.Show
>RETURN
>
>DEFINE CLASS form1 AS form
>
>	Top = 0
>	Left = 0
>	Height = 313
>	Width = 379
>	DoCreate = .T.
>	Caption = "Form1"
>	Name = "Form1"
>
>	ADD OBJECT cmdexit AS commandbutton WITH ;
>		Top = 143, ;
>		Left = 147, ;
>		Height = 27, ;
>		Width = 84, ;
>		Caption = "Exit", ;
>		Name = "cmdExit"
>
>	PROCEDURE KeyPress
>
>		LPARAMETERS nKeyCode, nShiftAltCtrl
>
>		*DEBUGOUT + TRANSFORM(nkeycode)+  "," + TRANS(nShiftAltCtrl)
>
>		DO CASE
>		CASE NOT BITTEST(nShiftAltCtrl,0)
>			DEBUGOUT "W/o Shift Key: " + TRANSFORM(nKeyCode)
>		CASE nKeyCode = 33 && shift + 1
>			DEBUGOUT "Your option was 1"
>
>		CASE nKeyCode = 64 && shift + 2
>			DEBUGOUT "Your option was 2"
>
>		CASE nKeyCode = 35 && shift + 3
>			DEBUGOUT "Your option was 3"
>
>		CASE nKeyCode = 36 && shift + 4
>			DEBUGOUT "Your option was 4"
>
>		CASE nKeyCode = 37 && shift + 5
>			DEBUGOUT "Your option was 5"
>
>		CASE nKeyCode = 94 && shift + 6
>			DEBUGOUT "Your option was 6"
>
>		CASE nKeyCode = 38 && shift + 7
>			DEBUGOUT "Your option was 7"
>
>		CASE nKeyCode = 42 && shift + 8
>			DEBUGOUT "Your option was 8"
>
>		CASE nKeyCode = 40 && shift + 9
>			DEBUGOUT "Your option was 9"
>
>		OTHERWISE
>			DEBUGOUT "Key code: " + TRANSFORM(nKeyCode)
>		ENDCASE
>	ENDPROC
>
>	PROCEDURE cmdexit.Click
>		Thisform.Release()
>	ENDPROC
>
>
>ENDDEFINE
>
>
>>Have a strange problem here with the keypress event if a form, I have to capture a sequencial shift + n from the keyborad where n can be 1 to 8.
>>I can´t intercept the keystrokes for shft + 6 in the alphanumeric keys, and also if I try to capture the shft + 5 in the numeric keyborad it doesn't return any value (any other combination of Shift + N works) where N = 1 to 9.
>>Can someone please help-me to get it fixed
>>TIA
>>
>>My code in a test form in the keypress event
>>
><snip>
Previous
Reply
Map
View

Click here to load this message in the networking platform