symbian 中的各种菜单响应函数,键盘事件响应函数的问题
一直有个疑问,现在请教一下高手
我用carbide.c++2.0新建工程向导建立了一个带有UI Designer的工程,这是一个基于多视图的程序,默认会有一个试图
代码都是自动创建的
然后我发现:
在UI文件中:
/**
* Handle a command for this appui (override)
* @param aCommand command id to be handled
*/
void CcrazysocketAppUi::HandleCommandL( TInt aCommand )
{
// [[[ begin generated region: do not modify [Generated Code]
TBool commandHandled = EFalse;
switch ( aCommand )
{ // code to dispatch to the AppUi's menu and CBA commands is generated here
default:
break;
}
if ( !commandHandled )
{
if ( aCommand == EAknSoftkeyExit || aCommand == EEikCmdExit )
{
Exit();
}
}
// ]]] end generated region [Generated Code]
}
/**
* Override of the HandleKeyEventL virtual function
* @return EKeyWasConsumed if event was handled, EKeyWasNotConsumed if not
* @param aKeyEvent
* @param aType
*/
TKeyResponse CcrazysocketAppUi::HandleKeyEventL(
const TKeyEvent& aKeyEvent,
TEventCode aType )
{
// The inherited HandleKeyEventL is private and cannot be called
// [[[ begin generated region: do not modify [Generated Contents]
// ]]] end generated region [Generated Contents]
return EKeyWasNotConsumed;
}
在container文件中:
/**
* Handle key events.
*/
TKeyResponse CCrazysocketContainer::OfferKeyEventL(
const TKeyEvent& aKeyEvent,
TEventCode aType )
{
// [[[ begin generated region: do not modify [Generated Contents]
// ]]] end generated region [Generated Contents]
if ( iFocusControl != NULL
&& iFocusControl->OfferKeyEventL( aKeyEvent, aType ) == EKeyWasConsumed )
{
return EKeyWasConsumed;
}
return CCoeControl::OfferKeyEventL( aKeyEvent, aType );
}
在VIEW文件中:
void CcrazysocketContainerView::HandleCommandL( TInt aCommand )
请问这些函数,都是干什么的,什么时候用,区别和联系时什么