本文主要是介绍让程序用自定义的菜单-自定义菜单AVKON_VIEW,CBA,MENU_BAR,MENU_PANE,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
注意:一般情况下不要修改CBA栏的左键ID,默认就是EAknSoftkeyOptions,不要修改为别的。
// -----------------------------------------------------------------------------
// help menu avkon
//在CHelpView::ConstructL()函数中调用
// -----------------------------------------------------------------------------
RESOURCE AVKON_VIEW r_help_menu
{
menubar = r_help_menu_bar;
//cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT;
//自定义CBA
cba = r_help_menu_cba;
}
//定义CBA栏
RESOURCE CBA r_help_menu_cba
{
buttons=
{
AVKON_CBA_BUTTON
{
id = EAknSoftkeyOptions;
txt = qtn_hewb_option;
},
AVKON_CBA_BUTTON
{
id = EExit;
txt = qtn_hewb_exit;
}
};
}
//定义菜单块
RESOURCE MENU_BAR r_help_menu_bar
{
titles =
{
MENU_TITLE { menu_pane = r_help_menu_pane; }
};
}
//定义菜单面板
RESOURCE MENU_PANE r_help_menu_pane
{
items =
{
// added the new Options menu command here
MENU_ITEM
{
command = EInput;
txt = qtn_hewb_input;
//cascade = r_potato_menupane;
},
MENU_ITEM
{
command = EHelpTwo;
txt = qtn_hewb_helptwo;
}
};
}
//定义子菜单的菜单面板
RESOURCE MENU_PANE r_potato_menupane
{
items =
{
// added the new Options menu command here
MENU_ITEM
{
command = EMenuPotato1;
txt = qtn_menu_potato1;
},
MENU_ITEM
{
command = EMenuPotato2;
txt = qtn_menu_potato2;
}
};
}
//控制菜单的显示与隐藏,由系统调用
void CListView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
{
if (aResourceId != R_LIST_MENU_PANE)
return;
//如果没有记录的情况下,就隐藏EListComeCard,EListCallPerson,EListSendCard
if (0 == iSelectCountNum)
{
aMenuPane->SetItemDimmed(EListComeCard, ETrue);
aMenuPane->SetItemDimmed(EListCallPerson, ETrue);
aMenuPane->SetItemDimmed(EListSendCard, ETrue);
}
else
{
aMenuPane->SetItemDimmed(EListComeCard, EFalse);
aMenuPane->SetItemDimmed(EListCallPerson, EFalse);
aMenuPane->SetItemDimmed(EListSendCard, EFalse);
}
}
这篇关于让程序用自定义的菜单-自定义菜单AVKON_VIEW,CBA,MENU_BAR,MENU_PANE的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!