图学PowerBuilder----Pb中按键处理使用的键盘码

来源:互联网 发布:js给图片加边框 编辑:程序博客网 时间:2024/05/17 08:35
Keycode对照表
字母和数字键的键码值(keyCode)
按键 键码 按键 键码 按键 键码 按键 键码
A 65 J 74 S 83 1 49
B 66 K 75 T 84 2 50
C 67 L 76 U 85 3 51
D 68 M 77 V 86 4 52
E 69 N 78 W 87 5 53
F 70 O 79 X 88 6 54
G 71 P 80 Y 89 7 55
H 72 Q 81 Z 90 8 56
I 73 R 82 0 48 9 57

  

数字键盘上的键的键码值(keyCode) 功能键键码值(keyCode)
按键 键码 按键 键码 按键 键码 按键 键码
0 96 8 104 F1 112 F7 118
1 97 9 105 F2 113 F8 119
2 98 * 106 F3 114 F9 120
3 99 + 107 F4 115 F10 121
4 100 Enter 108 F5 116 F11 122
5 101 - 109 F6 117 F12 123
6 102 . 110         
7 103 / 111         


  

控制键键码值(keyCode)
按键 键码 按键 键码 按键 键码 按键 键码
BackSpace 8 Esc 27 Right Arrow 39 -_ 189
Tab 9 Spacebar 32 Dw Arrow 40 .> 190
Clear 12 Page Up 33 Insert 45 /? 191
Enter 13 Page Down 34 Delete 46 `~ 192
Shift 16 End 35 Num Lock 144 [{ 219
Control 17 Home 36 ;: 186 \| 220
Alt 18 Left Arrow 37 =+ 187 ]} 221
Cape Lock 20 Up Arrow 38 ,< 188 '" 222


多媒体键码值(keyCode)
按键 键码 按键 键码 按键 键码 按键 键码
音量加 175             
音量减 174             
停止 179             
静音 173             
浏览器 172             
邮件 180             
搜索 170             
收藏 171             


-------------------------------------------


pb  判断触发键盘按键   附:pb键盘键值枚举值

 

定义一个事件key(pbm_keydown),然后在事件里写  
  if   key=keyescape!   then  
        close(this)//要处理的事件  
  end   if   

 附:pb键盘键值枚举值

 

Type of key                    KeyCode values and descriptions
Mouse buttons KeyLeftButton! Left mouse button

KeyMiddleButton! Middle mouse button

KeyRightButton! Right mouse button
Letters    KeyA! - KeyZ! A - Z, uppercase or lowercase
Other symbols

KeyQuote! ' and "

KeyEqual! = and +

KeyComma! , and <

KeyDash! - and _

KeyPeriod! . and >

KeySlash! / and ?

KeyBackQuote! ` and ~

KeyLeftBracket! [ and {

KeyBackSlash! / and |

KeyRightBracket! ] and }

KeySemiColon! ; and :

 


Non-printing characters

KeyBack! Backspace

KeyTab!

KeyEnter!

KeySpaceBar!
Function keys

KeyF1! -

KeyF12! Function keys F1 to F12


Control keys

KeyShift!

KeyControl!

KeyAlt!KeyPause!

KeyCapsLock!

KeyEscape!

KeyPrintScreen!

KeyInsert!KeyDelete!
Navigation keys

KeyPageUp!

KeyPageDown!KeyEnd!

KeyHome!

KeyLeftArrow!

KeyUpArrow!

KeyRightArrow!

KeyDownArrow!
Numeric and symbol keys

Key0! 0 and )

Key1! 1 and !

Key2! 2 and @

Key3! 3 and #

Key4! 4 and $

Key5! 5 and %

Key6! 6 and ^

Key7! 7 and &

Key8! 8 and *

Key9! 9 and (
Keypad numbers

KeyNumpad0! - KeyNumpad9! 0 - 9 on the numeric keypad
Keypad symbols

KeyMultiply! * on numeric keypadKeyAdd! + on numeric keypadKeySubtract! - on numeric keypadKeyDecimal! . on numeric keypadKeyDivide! / on numeric keypadKeyNumLock!KeyScrollLock!