Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)

This page was last modified 18:47, 24 June 2008.

S60中为对话框添加菜单及响应命令的方法

From Forum Nokia Wiki

首先在RSS文件中建立菜单和对话框资源

RESOURCE MENU_BAR r_test_menu_bar
{
titles=
{
MENU_TITLE 
{
txt = ""; // the text is not used in Series 60
menu_pane = r_test_menu_pane;
}
};
}
RESOURCE MENU_PANE r_test_menu_pane
{
items =
{
MENU_ITEM
{
command = ECmdMenuTest;
txt = TEST_TEXT;
}
};
}
 
RESOURCE DIALOG test_dialog
{
……
buttons = R_AVKON_SOFTKEYS_OPTIONS_BACK;
……..
}


然后需要实现一个从CaknDialog派生的对话框类,并重写OkToExitL()和ProcessCommandL()函数用于显示菜单和命令响应.

TBool CTestDialog::OkToExitL(TInt aButtonId)
{
  if ( aButtonId == EAknSoftkeyOptions ) // press options button
  {
       CAknDialog:DisplayMenuL(); // display the menu
  }
  else if ( aButtonId == EAknSoftkeyBack )
  {
    return ETrue;
  }
 
  return EFalse;
}
 
void CTestDialog::ProcessCommandL( TInt aCommandId )
{
  switch ( aCommandId )
  {
  case EcmdMenuTest:
  {
    CAknInformationNote *note = new (ELeave) CAknInformationNote;
    note->ExecuteLD( _L( "Test" ) );
  }
  break;
}
CAknDialog::HideMenu(); // hide the menu after commands finished
}
Related Discussions
Thread Thread Starter Forum Replies Last Post
请教!FORM或者DIALOG可不可以有自定义的菜单? danielwang99 Symbian 3 2006-02-09 03:04
Nokia论坛技术资料Symbian解决方案-中文版 hoolee Symbian 460 Today 04:47
如何为对话框定义自己的菜单?? Drmy Symbian 15 2006-12-19 09:50
可否让对话框有时是菜单,有时是确定返回? sodangerous Symbian 11 2007-08-01 15:26
FORM 的问题,会的 大哥来指点一 下,谢了 NewLC Symbian 3 2006-04-24 10:11
 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX