网络孤客 2008-6-3 15:15
大侠,进来看看为什么不能进入菜单?
1、程序编译能正常通过。
2、使用模拟器,一启动菜单,就弹出UIResource.c, line:230,Sorry,but an error has occurred
3、在机上运行,弹出UIResource.c, line:235,Menu rsrc not found,并重启。
附程序(按向导自动生成的)
static Boolean MainFormDoCommand(UInt16 command)
{
Boolean handled = false;
switch (command)
{
case OptionsAboutSunRise:
{
FormType * frmP;
/* Clear the menu status from the display */
MenuEraseStatus(0);
/* Display the About Box. */
frmP = FrmInitForm (AboutForm);
FrmDoDialog (frmP);
FrmDeleteForm (frmP);
handled = true;
break;
}
default:
break;
}
return handled;
}
static Boolean MainFormHandleEvent(EventType * eventP)
{
......
case menuEvent:
return MainFormDoCommand(eventP->data.menu.itemID);
......
}
网络孤客 2008-6-4 09:45
呵呵,很开心,解决了!
在frmOpenEvent中加入
FrmSetMenu(frmP,MainMenuBar);
Greenland 2008-6-6 17:38
在PilRC中看看这个窗口的Menu一项中是否正确选择了菜单的ID
一般不需要用FrmSetMenu显式地设定菜单,除非是需要动态调用。
譬如说根据这台机子有没有蓝牙、红外、扩展卡,调用不同的菜单,避免没有该设备的机子显示这个命令。
网络孤客 2008-6-6 20:24
[quote]原帖由 [i]Greenland[/i] 于 2008-6-6 17:38 发表 [url=http://bbs.tompda.com/redirect.php?goto=findpost&pid=2987862&ptid=2174179][img]http://bbs.tompda.com/images/common/back.gif[/img][/url]
在PilRC中看看这个窗口的Menu一项中是否正确选择了菜单的ID
一般不需要用FrmSetMenu显式地设定菜单,除非是需要动态调用。
譬如说根据这台机子有没有蓝牙、红外、扩展卡,调用不同的菜单,避免没有该设备的机子显示 ... [/quote]
此为正解!