OfferKeyEventL不能响应按键操作?
写了测试代码测试按键控制。
重载了OfferKeyEventL函数
-
TKeyResponse CMyTest_S60AppView::OfferKeyEventL(const TKeyEvent &aKeyEvent, TEventCode aType){
-
// We only want the key press, not the key up/down event
-
if ( aType == EEventKey )
-
{
-
// Check if the 2 key was pressed
-
if ( aKeyEvent.iCode == '1' )
-
{
-
iKeyPressCount ++;
-
return EKeyWasConsumed;
-
}
-
return EKeyWasNotConsumed;
-
}
编译运行,可是怎么按都没有响应,在Debug 中下断点,也不停下来。
后来到Nokia论坛看了一下,发现使用 AddToStackL(iAppView); 添加到列表中才能处理按键响应。
-
void CMyTest_S60AppUi::ConstructL()
-
{
-
// Initialise app UI with standard value.
-
BaseConstructL();
-
-
// Create view object
-
iAppView = CMyTest_S60AppView::NewL( ClientRect() );
-
-
AddToStackL(iAppView);
-
-
PrivacyStatementL();
-
iAppView->BeginSession();
-
}
Popularity: 4% [?]
Related
Comments
One Response to “OfferKeyEventL不能响应按键操作?”
原来是这个原因,晕了…
[Reply]