请问这个菜单加载的程序哪里出了错?

allen1986 2009-03-31 12:03:53
我在这里将数据定义,初始化函数,和菜单加载函数那出来,请大家帮忙分析,我是在_HandleEvent()里调用menu_Start()
字符窜资源与位图资源在资源编辑器中已经编译了。
运行结果:该程序运行后显示的是一片空白。
typedef struct _CMenu
{
AEEApplet a;
AEEDeviceInfo DeviceInfo; // always have access to the hardware device information

IDisplay *pIDisplay; // give a standar way to access the display interface
IShell *pIShell; // give a standar way to access the shell interface

int m_nScrWidth;
int m_nScrHeight;
int m_nLineHeight;
int m_nLargeLineHeight;

AEERect m_nCIntAreaRect;
uint8 m_nState;
void* m_pObj;
}CMenu;

static boolean menu_Start(CMenu* pApp)
{
IMenuCtl* pMenuCtl=NULL;
CtlAddItem rMenuItem;
AEERect nRect;
AEEItemStyle nNormal;
AEEItemStyle nSel;
if(ISHELL_CreateInstance(pApp->a.m_pIShell, AEECLSID_MENUCTL,
(void**)(&pApp->m_pObj))!=SUCCESS)
return FALSE;


// Fill in the CtlAddItem structure values
pMenuCtl=(IMenuCtl*)pApp->m_pObj;
IMENUCTL_Reset(pMenuCtl);
IMENUCTL_SetActive(pMenuCtl,FALSE);
rMenuItem.pText=NULL;
rMenuItem.pImage=NULL;
rMenuItem.pszResImage=rMenuItem.pszResText=CMENU_RES_FILE;//resourc file name
rMenuItem.wFont=AEE_FONT_NORMAL;

rMenuItem.wText=IDS_STRING_START;
rMenuItem.wImage=IDI_IMAGE_STA;
rMenuItem.wItemID=IDS_STRING_START;
IMENUCTL_AddItemEx(pMenuCtl,&rMenuItem);

rMenuItem.wText=IDS_STRING_SEL;
rMenuItem.wImage=IDI_IMAGE_SEL;
rMenuItem.wItemID=IDS_STRING_SEL;
IMENUCTL_AddItemEx(pMenuCtl, &rMenuItem);

nNormal.ft=AEE_FT_NONE;
nNormal.xOffset=nNormal.yOffset=0;
nNormal.roImage=AEE_RO_COPY;

nSel.ft=AEE_FT_BOX;
nSel.xOffset=nSel.yOffset=0;
nSel.roImage=AEE_RO_NOT;

IMENUCTL_SetStyle(pMenuCtl, &nNormal, &nSel);

IMENUCTL_SetProperties(pMenuCtl, IMENUCTL_GetProperties(pMenuCtl) &
~(MP_ICON_TEXT_TOP));
SETAEERECT(&nRect, 0, 0, pApp->m_nScrWidth, pApp->m_nScrHeight);
IMENUCTL_SetRect(pMenuCtl, &nRect);
IMENUCTL_SetActive(pMenuCtl, TRUE);
IDISPLAY_Update(pApp->pIDisplay);
return TRUE;
}

boolean CMenu_InitAppData(CMenu* pMe)
{
// Get the device information for this handset.
// Reference all the data by looking at the pMe->DeviceInfo structure
// Check the API reference guide for all the handy device info you can get
pMe->DeviceInfo.wStructSize = sizeof(pMe->DeviceInfo);
ISHELL_GetDeviceInfo(pMe->a.m_pIShell,&pMe->DeviceInfo);

// Insert your code here for initializing or allocating resources...
pMe->pIShell=pMe->a.m_pIShell;
pMe->pIDisplay=pMe->a.m_pIDisplay;
// Insert your code here for initializing or allocating resources...
pMe->m_nLineHeight=IDISPLAY_GetFontMetrics(pMe->a.m_pIDisplay,
AEE_FONT_NORMAL,
NULL,
NULL);
pMe->m_nLargeLineHeight=IDISPLAY_GetFontMetrics(pMe->a.m_pIDisplay,
AEE_FONT_LARGE,
NULL,
NULL);
pMe->m_nScrHeight=pMe->DeviceInfo.cyScreen;
pMe->m_nScrWidth=pMe->DeviceInfo.cxScreen;
SETAEERECT(&pMe->m_nCIntAreaRect,
0,
0,
pMe->DeviceInfo.cxScreen,
pMe->DeviceInfo.cyScreen-pMe->m_nLargeLineHeight);
pMe->m_pObj=NULL;


// if there have been no failures up to this point then return success
return TRUE;
}
...全文
1479 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
tx040316 2009-04-08
  • 打赏
  • 举报
回复
没看明白什么意思。。。。。。。。。。。。。
sunyymq 2009-03-31
  • 打赏
  • 举报
回复
你的程序好乱啊。建议整理下。
menu顺序setrect,setsytle,setactive,setsel,最后update
allen1986 2009-03-31
  • 打赏
  • 举报
回复
试了下,不行 啊。
zsf81 2009-03-31
  • 打赏
  • 举报
回复
SETAEERECT(&nRect, 0, 0, pApp->m_nScrWidth, pApp->m_nScrHeight);
IMENUCTL_SetRect(pMenuCtl, &nRect);
放前面,

rMenuItem.wItemID=IDS_STRING_START;
witemId用数字,0 1 2...不要重复

3,021

社区成员

发帖
与我相关
我的任务
社区描述
本论坛以AI、WoS 、XR、IoT、Auto、生成式AI等核心板块组成,为开发者提供便捷及高效的学习和交流平台。 高通开发者专区主页:https://qualcomm.csdn.net/
人工智能物联网机器学习 技术论坛(原bbs) 北京·东城区
社区管理员
  • csdnsqst0050
  • chipseeker
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧