Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Convert VB keycode to asci
Message
From
24/02/2003 13:41:36
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Convert VB keycode to asci
Miscellaneous
Thread ID:
00757107
Message ID:
00757107
Views:
44
hi everybody

i am using the MSComCtlLib.TreeCtrl.2 on a form which is trapping keys in the KeyPress event. When the activeX has the focus however, the form does not proccess the key events. so i am forwarding the KeyUp event from the tree object to the forms KeyPress event - works good.
BUT, i am not getting asci codes, rather VbKey Codes. Well, i found out how to translate letters and numbers - no problem, but all the other keys like "-" or "!" i have no clue how to change those.
here is the conversion i came up with so far:
*** ActiveX Control Event ***
LPARAMETERS keycode, SHIFT
LOCAL ;
   NewKeyKode

DO CASE
   CASE BETWEEN(keycode, 65, 90)
      * *** letters
      IF SHIFT = 0
         * *** lower case
         NewKeyKode = ASC(LOWER(CHR(keycode)))
      ELSE
         * *** upper case
         NewKeyKode = ASC(UPPER(CHR(keycode)))
      ENDIF
   CASE BETWEEN(keycode, 48, 57)
      * *** numbers
      NewKeyKode = keycode
   *CASE BETWEEN(keycode, ?, ?)
      * *** sings and other
ENDCASE
ThisForm.KeyPress(NewKeyKode, SHIFT)
Maybe i am going about it the wrong way. Any suggestions? Thanks in advance!
Next
Reply
Map
View

Click here to load this message in the networking platform