用ShowCategory174Screen函数做菜单列表显示函数。由于菜单列表是从MTK文件系统里取出来的字符串数据,所以要进行字符串转换:
void ChineseString(U8 *ucs2_data, U8 *str)
{
int len;
U8 *buf;
len = strlen((char *)str);
mmi_chset_text_to_ucs2(buf, len+1, (U8 *)str);
ucs2_data = buf;
}
/**********************************************************
*
*
***********************************************************/
void dynamic_menuindex(S32 index)
{
dcontext.highlightedIndex = (U8)index;
}
/**********************************************************
*
*
***********************************************************/
void exit_dynamic_menu(void)
{
GoBackHistory();
}
/**************************************************************
*
*
***************************************************************/
void enter_second_menu(void)
{
if(dcontext.Nextmenuflag[dcontext.highlightedIndex] == 0 )
{
level = dcontext.nlevel[dcontext.highlightedIndex];
epos_app1_main();
}
else if(dcontext.Nextmenuflag[dcontext.highlightedIndex] == 1)
{
level = dcontext.nlevel[dcontext.highlightedIndex];
dynamic_entry_second_menu();
}
}
void dynamic_entry_menu(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U8 *guiBufferpointer;
U8 *listItems[9];
// U8 *titleText;
U16 i;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
level = 0;
memset(listItems,0,sizeof(listItems));
EntryNewScreen(SCR_ID_DYNAMIC_MAINMENU,NULL,dynamic_entry_menu,NULL);
getdynamicinfo(0);
for(i=0;i {
listItems[i] = Strbuf[i];
}
RegisterHighlightHandler(dynamic_menuindex);
guiBufferpointer = GetCurrGuiBuffer(SCR_ID_DYNAMIC_MAINMENU);
ShowCategory174Screen(
NULL,
NULL,
(PU8) GetString(STR_GLOBAL_OK),
NULL,
//(PU8) GetImage(IMG_GLOBAL_OK),
(PU8) GetString(STR_GLOBAL_BACK),
NULL,
//(PU8) GetImage(IMG_GLOBAL_BACK),
dcontext.NumOfItem,
listItems,
NULL,
NULL,
0,
0,
guiBufferpointer);
SetLeftSoftkeyFunction(enter_second_menu, KEY_EVENT_UP);
SetRightSoftkeyFunction(exit_dynamic_menu, KEY_EVENT_UP);
}
最开始在左键确认上先进性判断再按左键确认所以高亮listId总是显示不对,后来改成这样先确认再判断就没问题了。
阅读(1907) | 评论(0) | 转发(0) |