Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Possible bug in keypress
Message
 
To
02/08/2007 15:06:16
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01245609
Message ID:
01245620
Views:
17
Tore, I didn't test the code, but one thing I saw You call DODEFAULT() w/o second parameter. When you call DODEFAULT() function you always have to send the same number of parameters as your method/event:
LPARAMETERS nKeyCode, nShiftAltCtrl
if IsAlpha(Chr(nKeyCode)) && and nKeyCode=>0 && Remove the first && to see the bug
  DoDefault(Asc(Upper(Chr(nKeyCode))), nShiftAltCtrl)
  NoDefault
EndIf

Also what happens when you move NODEFAULT before DODEFAULT()?
Like:
LPARAMETERS nKeyCode, nShiftAltCtrl
if IsAlpha(Chr(nKeyCode)) && and nKeyCode=>0 && Remove the first && to see the bug
  NoDefault
  DoDefault(Asc(Upper(Chr(nKeyCode))), nShiftAltCtrl)
EndIf



>I have created a textbox baseclass which I use whenever I want only uppercase text. The code in Keypress is/was as follows
>LPARAMETERS nKeyCode, nShiftAltCtrl
>if IsAlpha(Chr(nKeyCode)) && and nKeyCode=>0 && Remove the first && to see the bug
>  DoDefault(Asc(Upper(Chr(nKeyCode))))
>  NoDefault
>EndIf
>This code runs fine EXCEPT when any of the function keys are cleared, because default function keys set negative values for nKeyCode, and cause chr(nKeyCode) to generate an error. So I added a check for nKeyCode>0, which appeared to work fine for most keys, but not all. The following keys are simply "eaten" when I check for nKeyCode>0 by adding the "and nKeyCode=>0": D,E,F,G,T,U,V and W, plus a few international characters.
>
>I checked the ascii value for these characters:
>D 68 0x00000044
>E 69 0x00000045
>F 70 0x00000046
>G 71 0x00000047
>T 84 0x00000054
>U 85 0x00000055
>V 86 0x00000054
>W 87 0x00000056
>My observation is that the groups of "eaten" characters are exactly 4 bit apart, but I have no idea of why.
>
>In desperation I isolated the two conditions, and then it worked as expected:
>LPARAMETERS nKeyCode, nShiftAltCtrl
>if IsAlpha(Chr(nKeyCode))
>  If nKeyCode=>0
>    DoDefault(Asc(Upper(Chr(nKeyCode))))
>    NoDefault
>  EndIf
>EndIf
>
>Does anybody have a logical explanation for this strange behavior, which must be an obscure bug?
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform