IT很好玩

学习brew第二课

今天遇到的问题是,菜单为什么不能动?哪个地方设置的不对?不清楚,完全按照说明书做也不行。

经过在Handle_Event中的测试,发现自己通过使用
    IMENUCTL_SetSel(pMenu,IMENUCTL_GetSel(pMenu)+1);
    IMENUCTL_Redraw(pMenu);
可以让菜单动起来。看来只有这个办法了。奇怪为什么不能将COMMAND信息传递给AEE外壳呢?

创建一个菜单 如下代码

IShell * m_pIShell;
IMenuCtl * pMenu;
AECHAR szText1[] = {'I','j','j','v','i','s','i','o', 'n', '\0'};
AECHAR szText2[] = {'S','e','a','v','i','s','i','o', 'n', '\0'};
AECHAR szText3[] = {'2','e','a','v','i','s','i','o', 'n', '\0'};
AECHAR szText4[] = {'3','e','a','v','i','s','i','o', 'n', '\0'};
AECHAR szText5[] = {'4','e','a','v','i','s','i','o', 'n', '\0'};
AECHAR szText6[] = {'5','e','a','v','i','s','i','o', 'n', '\0'};
AECHAR szText7[] = {'6','e','a','v','i','s','i','o', 'n', '\0'};
AECHAR szText8[] = {'7','e','a','v','i','s','i','o', 'n', '\0'};
AECHAR szText9[] = {'8','e','a','v','i','s','i','o', 'n', '\0'};
AECHAR szText10[] = {'9','e','a','v','i','s','i','o', 'n', '\0'};
   AEEDeviceInfo* pDeviceInfo;
int nScreenWidth;
int nScreenHeight;
   AEERect rRect;
void *m_ppObj;

   ISHELL_GetItemStyle( m_pIShell, AEE_IT_MENU, &rNormalStyle, &rSelStyle );
   rNormalStyle.roImage = AEE_RO_TRANSPARENT;
   rSelStyle.roImage = AEE_RO_TRANSPARENT;

   //ISHELL_CreateInstance( m_pIShell, AEECLSID_MENUCTL, (void**)( &pMenu ));
   ISHELL_CreateInstance( m_pIShell, AEECLSID_SOFTKEYCTL, (void**)( &pMenu ));
   //ISHELL_CreateInstance( m_pIShell, AEECLSID_LISTCTL, (void**)( &pMenu ));
   if(pMenu!=NULL)
   {
    IMENUCTL_SetTitle(pMenu,NULL,0,szText1);

    pDeviceInfo = (AEEDeviceInfo*) MALLOC( sizeof( AEEDeviceInfo ) );
    if( !pDeviceInfo )
     return FALSE;
    ISHELL_GetDeviceInfo( m_pIShell, pDeviceInfo );
    //pApp->m_nScreenColorDepth = pDeviceInfo->nColorDepth;
    nScreenWidth = pDeviceInfo->cxScreen;
    nScreenHeight = pDeviceInfo->cyScreen;
    FREE( pDeviceInfo );

    IMENUCTL_AddItem(pMenu,NULL,0,1,szText2,0x5001);
    IMENUCTL_AddItem(pMenu,NULL,0,2,szText3,0x5002);
    IMENUCTL_AddItem(pMenu,NULL,0,3,szText4,0x5003);
    IMENUCTL_AddItem(pMenu,NULL,0,4,szText5,0x5004);
    IMENUCTL_AddItem(pMenu,NULL,0,5,szText6,0x5005);
    IMENUCTL_AddItem(pMenu,NULL,0,6,szText7,0x5006);
    IMENUCTL_AddItem(pMenu,NULL,0,7,szText8,0x5007);
    IMENUCTL_AddItem(pMenu,NULL,0,8,szText9,0x5008);
    IMENUCTL_AddItem(pMenu,NULL,0,9,szText10,0x5009);

    SETAEERECT( &rRect, 0, 0, nScreenWidth, nScreenHeight);
    IMENUCTL_SetRect( pMenu, &rRect );
    IMENUCTL_SetStyle( pMenu, &rNormalStyle, &rSelStyle );

    IMENUCTL_SetProperties( pMenu,MP_WRAPSCROLL|MP_UNDERLINE_TITLE);
    IMENUCTL_EnableCommand(pMenu,TRUE);
    // Activate the control and draw it on the screen

    IMENUCTL_SetActive( pMenu, TRUE );

删除一个菜单的代码是

   IMENUCTL_Release(pMenu);

posted on 2006-02-12 02:56 肥崽 阅读(510) 评论(0)  编辑 收藏 引用

只有注册用户登录后才能发表评论。