请哪位好心人告诉我几个 Navigation key 的keyCode的宏定义:
Arrow up
Arrow down
Arrow left
Arrow right
The Selection key
虽然可以测出来上述key的code,但总不能hardcode在代码中吧,查了半天也没有找到。麻烦哪位好心人告诉我,非常感谢!
请哪位好心人告诉我几个 Navigation key 的keyCode的宏定义:
Arrow up
Arrow down
Arrow left
Arrow right
The Selection key
虽然可以测出来上述key的code,但总不能hardcode在代码中吧,查了半天也没有找到。麻烦哪位好心人告诉我,非常感谢!
参考e32keys.h
Developer Library » API Reference » C++ API reference » Window Server » TKeyCode
非常感谢PeterJiang的帮助。
不过我原来就试过Enum TKeyCode 中定义的如下key code:
EKeyLeftArrow
EKeyRightArrow
EKeyUpArrow
EKeyDownArrow
EKeyEnter
但发现上述定义和实际的手机键盘事件函数
TKeyResponse CCoeControl::OfferKeyEventL(
const TKeyEvent& aKeyEvent, TEventCode aType )中
aKeyEvent.iCode的值不一致。
(注意,如果在模拟器中运行,而且是按计算机键盘事件,上述宏和实际的运行值一致)
我在程序中使用是正常的,但注意不是EKeyEnter而是EKeyOK
Code:TInt code = aKeyEvent.iCode; switch(code) { case EKeyOK: //your code return EKeyWasConsumed; break; case EKeyUpArrow: //your code return EKeyWasConsumed; break; case EKeyDownArrow: //your code return EKeyWasConsumed; break; default: return EKeyWasNotConsumed; break; }
try this please.....
enum TKeyCode
{
EKeyNull=0x0000, /**< Code for the Null key. */
EKeyBell=0x0007, /**< Code for the Bell key*/
EKeyBackspace=0x0008, /**< Code for the Backspace key */
EKeyTab=0x0009, /**< Code for the Tab key*/
EKeyLineFeed=0x000a, /**< Code for the Linefeed key*/
EKeyVerticalTab=0x000b, /**< Code for the Vertical tab key*/
EKeyFormFeed=0x000c, /**< Code for the Form feed key*/
EKeyEnter=0x000d, /**< Code for the Enter key */
EKeyEscape=0x001b, /**< Code for the Escape key */
EKeySpace=0x0020, /**< Code for the Space key*/
EKeyDelete=0x007f, /**< Code for the Delete (Del) key*/
EKeyPrintScreen=ENonCharacterKeyBase,/**< Code for the Print screen key */
EKeyPause, /**< Code for the Pause key*/
EKeyHome, /**< Code for the Home key*/
EKeyEnd, /**< Code for the End key*/
EKeyPageUp, /**< Code for the Page up key*/
EKeyPageDown, /**< Code for the Page down key*/
EKeyInsert, /**< Code for the Insert key*/
EKeyLeftArrow, /**< Code for the Left arrow key*/
EKeyRightArrow, /**< Code for the Right arrow key*/
EKeyUpArrow, /**< Code for the Up arrow key*/
EKeyDownArrow, /**< Code for the Down arrow key*/
EKeyLeftShift, /**< Code for the left Shift key*/
EKeyRightShift, /**< Code for the right Shift key*/
EKeyLeftAlt, /**< Code for the left Alt key*/
EKeyRightAlt, /**< Code for the right Alt key*/
EKeyLeftCtrl, /**< Code for the left Control (Ctrl) key*/
EKeyRightCtrl, /**< Code for the right Control (Ctrl) key.*/
EKeyLeftFunc, /**< Code for the left Fn key.*/
EKeyRightFunc, /**< Code for the right Fn key.*/
EKeyCapsLock, /**< Code for the Caps lock key.*/
EKeyNumLock, /**< Code for the Num lock key.*/
EKeyScrollLock, /**< Code for the Scroll lock key.*/
EKeyF1, /**< Code for the F1 function key.*/
EKeyF2, /**< Code for the F2 function key.*/
EKeyF3, /**< Code for the F3 function key.*/
EKeyF4, /**< Code for the F4 function key.*/
EKeyF5, /**< Code for the F5 function key.*/
EKeyF6, /**< Code for the F6 function key.*/
EKeyF7, /**< Code for the F7 function key.*/
EKeyF8, /**< Code for the F8 function key.*/
EKeyF9, /**< Code for the F9 function key.*/
EKeyF10, /**< Code for the F10 function key.*/
EKeyF11, /**< Code for the F11 function key.*/
EKeyF12, /**< Code for the F12 function key.*/
EKeyF13, /**< Code for the F13 function key.*/
EKeyF14, /**< Code for the F14 function key.*/
EKeyF15, /**< Code for the F15 function key.*/
EKeyF16, /**< Code for the F16 function key.*/
EKeyF17, /**< Code for the F17 function key.*/
EKeyF18, /**< Code for the F18 function key.*/
EKeyF19, /**< Code for the F19 function key.*/
EKeyF20, /**< Code for the F20 function key.*/
EKeyF21, /**< Code for the F21 function key.*/
EKeyF22, /**< Code for the F22 function key.*/
EKeyF23, /**< Code for the F23 function key.*/
EKeyF24, /**< Code for the F24 function key.*/
EKeyOff, /**< Code for the Off key.*/
EKeyIncContrast, /**< Code for the Increase contrast key.*/
EKeyDecContrast, /**< Code for the Decrease contrast key.*/
EKeyBacklightOn, /**< Code for the Backlight on key.*/
EKeyBacklightOff, /**< Code for the Backlight off key.*/
EKeyBacklightToggle, /**< Code for the Backlight toggle key.*/
EKeySliderDown, /**< Code for the Slider down key.*/
EKeySliderUp, /**< Code for the Slider up key.*/
EKeyMenu, /**< Code for the Menu key.*/
EKeyDictaphonePlay, /**< Code for the Dictaphone play key.*/
EKeyDictaphoneStop, /**< Code for the Dictaphone stop key.*/
EKeyDictaphoneRecord, /**< Code for the Dictaphone record key.*/
EKeyHelp, /**< Code for the Help key.*/
EKeyDial, /**< Code for the Dial key.*/
EKeyScreenDimension0, /**< Code for the first Screen dimension change key.*/
EKeyScreenDimension1, /**< Code for the second Screen dimension change key.*/
EKeyScreenDimension2, /**< Code for the third Screen dimension change key.*/
EKeyScreenDimension3, /**< Code for the fourth Screen dimension change key.*/
EKeyIncVolume, /**< Code for the increase colume key.*/
EKeyDecVolume, /**< Code for the decrease volume key.*/
EKeyDevice0, /**< Code for a device specific key.*/
EKeyDevice1, /**< Code for a device specific key.*/
EKeyDevice2, /**< Code for a device specific key. */
EKeyDevice3, /**< Code for a device specific key.*/
EKeyDevice4, /**< Code for a device specific key.*/
EKeyDevice5, /**< Code for a device specific key.*/
EKeyDevice6, /**< Code for a device specific key.*/
EKeyDevice7, /**< Code for a device specific key.*/
EKeyDevice8, /**< Code for a device specific key.*/
EKeyDevice9, /**< Code for a device specific key.*/
EKeyDeviceA, /**< Code for a device specific key.*/
EKeyDeviceB, /**< Code for a device specific key.*/
EKeyDeviceC, /**< Code for a device specific key.*/
EKeyDeviceD, /**< Code for a device specific key.*/
EKeyDeviceE, /**< Code for a device specific key.*/
EKeyDeviceF, /**< Code for a device specific key.*/
EKeyApplication0, /**< Code for an Application launcher key.*/
EKeyApplication1, /**< Code for an Application launcher key.*/
EKeyApplication2, /**< Code for an Application launcher key.*/
EKeyApplication3, /**< Code for an Application launcher key.*/
EKeyApplication4, /**< Code for an Application launcher key.*/
EKeyApplication5, /**< Code for an Application launcher key.*/
EKeyApplication6, /**< Code for an Application launcher key.*/
EKeyApplication7, /**< Code for an Application launcher key.*/
EKeyApplication8, /**< Code for an Application launcher key.*/
EKeyApplication9, /**< Code for an Application launcher key.*/
EKeyApplicationA, /**< Code for an Application launcher key.*/
EKeyApplicationB, /**< Code for an Application launcher key.*/
EKeyApplicationC, /**< Code for an Application launcher key.*/
EKeyApplicationD, /**< Code for an Application launcher key.*/
EKeyApplicationE, /**< Code for an Application launcher key.*/
EKeyApplicationF, /**< Code for an Application launcher key.*/
EKeyYes, /**< Code for the Yes key.*/
EKeyNo, /**< Code for the No key.*/
EKeyIncBrightness, /**< Code for the increase brightness key.*/
EKeyDecBrightness, /**< Code for the decrease brightness key. */
EKeyKeyboardExtend /**< Code for flip actuated when keypad extends to full keyboard.*/
};
good luck
sorry,补充一下,上面的所有keycode在实机和模拟器上都能正确运行。
不过我不是使用series,用的其他平台。
祝好运
try:
也可以设置断点,看看实际到底什么值Code:if(aType == EEventKeyDown) { switch(aKeyEvent.iScanCode) { case EStdKeyLeftArrow: ... break; case EStdKeyRightArrow: ... break; case EStdKeyUpArrow: ... break; case EStdKeyDownArrow: ... break; case EStdKeyDevice3://ok key ... break;
I'd just be the catcher in the rye
hoolee
非常感谢PeterJiang,SymbianLN,hoolee的热心帮助。
综合大家的建议,我今天又仔细试了几遍.
我的环境是Symbian 8.0a S60_2nd_FP2_SC 。
实际代码的测试结果如下:
上述Key Code 的枚举定义在<e32keys.h>中的enum TKeyCode。PHP Code:TKeyResponse CMyTestAppUi_HandleKeyEventL( const TKeyEvent& aKeyEvent,
TEventCode aType )
{
switch( aKeyEvent.iCode )
{
case EKeyLeftArrow: // 63495
break ;
case EKeyRightArrow: // 63496
break;
case EKeyUpArrow: // 63497
break;
case EKeyDownArrow: // 63498
break;
case EKeyDevice3: // 63557 Navigation Selection key
break;
}
return( EKeyWasNotConsumed );
}
这个文件中有两套key code的定义,一套是enum TStdScanCode,另一套是
enum TKeyCode。
联系方式:msn: daijt5@hotmail.com
Last edited by daijuntang; 2006-03-29 at 08:16.
对不起,借贴提个问题
〉〉两套key code的定义,一套是enum TStdScanCode,另一套是enum TKeyCode。
上面的这两个定义,我也看到过。不过我使用的都是TKeyCode,包括FEP输入的场合。
我曾经在画面处理key事件的时候,也尝试过Scancode,但遇到了问题,好像是code值不符,1年前的事情记不清楚了。
SDK的文档也看过了,但是体会不深。
拜托各位如果了解的话,请详细的说明一下。
谢谢大家。
和同事讨论了一下,关于TStdScanCode和TKeyCode,有了以下几点看法。
1,一般情况下,两者使用哪个都可以,但是对于同一个键,他们的value是不同的
我自己的话,常常选择icode在offerkeyeventl函数中处理
2,组合键的情况下,需要通过iscancode记忆按下的几个键,这时候是要用到TStdScanCode
3,有外界键盘的时候,需要使用icode,因为TKeyCode能够支持外挂。
抛砖引玉,希望各位多多指点