symbian 中的各种菜单响应函数,键盘事件响应函数的问题

sanjiaomao001 2010-03-30 05:33:01
一直有个疑问,现在请教一下高手
我用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 )
请问这些函数,都是干什么的,什么时候用,区别和联系时什么
...全文
277 11 打赏 收藏 转发到动态 举报
写回复
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
Prison2Break 2010-06-27
  • 打赏
  • 举报
回复
怎么屏蔽掉CBA呢
sanjiaomao001 2010-04-06
  • 打赏
  • 举报
回复
楼上说跟一把是什么意思?
断点调试一下吗,
可是carbide.c++有的地方不能单步执行(有些系统生成的代码),
否则就错误,
我应该怎么进行断点调试啊?
多谢了啊
pointerfree 2010-04-06
  • 打赏
  • 举报
回复
当屏蔽掉CBA的时候这些函数都没用了
pointerfree 2010-04-06
  • 打赏
  • 举报
回复
HandleKeyEventL 这个我感觉应该可以理解我 系统菜单的回调函数
nuist320 2010-04-05
  • 打赏
  • 举报
回复
建一个工程 跟一把就知道了
一阵大风风 2010-03-31
  • 打赏
  • 举报
回复
TKeyResponse CcrazysocketAppUi::HandleKeyEventL(
const TKeyEvent& aKeyEvent,
TEventCode aType )
是按键事件

TKeyResponse CCrazysocketContainer::OfferKeyEventL(
const TKeyEvent& aKeyEvent,
TEventCode aType )
是按键处理

有一些自己特殊定义的,可以通过他们实现,剩下的可以抛给系统帮你实现

要先看框架,这些.cpp谁先调的谁,否则越看越糊涂。
漁_夫 2010-03-31
  • 打赏
  • 举报
回复
这个需要自己在实践中体会
sanjiaomao001 2010-03-31
  • 打赏
  • 举报
回复
多谢楼上
看了看,还是不太明白
有谁能再讲的详细点吗
nzc123 2010-03-31
  • 打赏
  • 举报
回复
每天回帖即可获得10分可用分!
sanjiaomao001 2010-03-31
  • 打赏
  • 举报
回复
多谢楼上,框架大致看了,说实话,不是太懂这几个函数,但是写程序大致还是知道在哪写代码
就是想深入学习一下
bsr2009 2010-03-30
  • 打赏
  • 举报
回复
view中的HandleCommandL一般都可以跳转到UI来实现的.
LZ请参考:
Symbian OS — 应用程序架构
相关推荐

3,120

社区成员

发帖
与我相关
我的任务
社区描述
塞班系统(Symbian系统)是塞班公司为手机而设计的操作系统,它的前身是英国宝意昂公司的 EP ( Electronic Piece of cheese)操作系统。
社区管理员
  • Symbian社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告