当前位置: 代码迷 >> Brew >> Listwidget 无法显示
  详细解决方案

Listwidget 无法显示

热度:4907   发布时间:2013-02-26 00:00:00.0
求助Listwidget 无法显示。
本帖最后由 wm356924565 于 2010-04-30 11:55:13 编辑

static boolean CreateMainForm(BUIWTask *pMe)
{
int result = 0;
IWidget                *containerWdg = NULL;
WidgetPos              wp;
WExtent                tsWE;
IWidget                *titleWidget;
IWidget                *softWidget;
/* IWidget                *staticWdg;
IWidget                *iWdg;
IWidget                *sWdg;
*/
result = ISHELL_CreateInstance(pMe->m_pShell, AEECLSID_FORM, (void **)&(pMe->m_pMainForm));
result += ISHELL_CreateInstance(pMe->m_pShell, AEECLSID_XYCONTAINER, (void **)&pMe->m_pXYContainer);
result += ISHELL_CreateInstance(pMe->m_pShell, AEECLSID_STATICWIDGET, (void **)&containerWdg);
result += ISHELL_CreateInstance(pMe->m_pShell,AEECLSID_LISTWIDGET,(void**)&pMe->m_pListWidget);

if(result != 0)
{
return EFAILED;
}


IFORM_GetTitleWidget((IForm*)pMe->m_pRootForm, &titleWidget);
IWIDGET_GetPreferredExtent(titleWidget,&tsWE);
tsWE.height = 30;
tsWE.width = pMe->DeviceInfo.cxScreen;
IWIDGET_SetExtent(titleWidget,&tsWE);
IWIDGET_SetFlags(titleWidget,IDF_ALIGN_MIDDLE|IDF_ALIGN_CENTER);
IWIDGET_SetBGColor(titleWidget,MAKE_RGB(15,118,209));
IFORM_SetText(pMe->m_pMainForm,FID_TITLE,L"伊索寓言");

IFORM_SetText(pMe->m_pMainForm, FID_SOFTKEY1, L"选项");
IFORM_SetText(pMe->m_pMainForm, FID_SOFTKEY2, L"返回");
/*IFORM_SetResText(pMe->m_pMainForm,FID_TITLE,BUIWTASK_RES_FILE,IDS_TITLE);
IFORM_SetSoftkeys(pMe->m_pMainForm,BUIWTASK_RES_FILE,IDS_SOFTKEY1,IDS_SOFTKEY2);*/
IFORM_GetSoftkeyWidget((IForm*)pMe->m_pRootForm,&softWidget);
IWIDGET_SetBGColor(softWidget,MAKE_RGB(15,118,209));
IWIDGET_SetExtent(softWidget,&tsWE);

HANDLERDESC_Init(&pMe->m_nHandlerDesc,mainFormHandleEvent,pMe,mainformFree);
IFORM_SetHandler(pMe->m_pMainForm,&pMe->m_nHandlerDesc);

IWIDGET_SetItemWidth(pMe->m_pListWidget, pMe->DeviceInfo.cxScreen - 16);
IWIDGET_SetItemHeight(pMe->m_pListWidget,30);
IWIDGET_SetTopIndex(pMe->m_pListWidget, 1);
IWIDGET_SetFocusIndex(pMe->m_pListWidget, 1);
IWIDGET_SetHintRows(pMe->m_pListWidget, 5);
IWIDGET_SetBGColor(pMe->m_pListWidget,MAKE_RGB(255, 0, 0));

ISHELL_CreateInstance(pMe->m_pShell,AEECLSID_SCROLLBARWIDGET,(void**)&pMe->m_pScrollWidget);
IWIDGET_SetProperty(pMe->m_pScrollWidget,PROP_SCROLLPAD,0);
IWIDGET_SetProperty(pMe->m_pScrollWidget,PROP_SCROLLHANDLEWIDTH,10);
IWIDGET_SetProperty(pMe->m_pScrollWidget,PROP_FLAGS, SBWF_ARROWS);
IWIDGET_SetProperty(pMe->m_pScrollWidget, PROP_SCROLLBARENDPAD, 7);
    IWIDGET_SetProperty(pMe->m_pScrollWidget, PROP_ACTIVE_SCROLLCOLOR, MAKE_RGB(100, 200, 0));
    IWIDGET_SetProperty(pMe->m_pScrollWidget, PROP_ACTIVE_SCROLLHANDLECOLOR, MAKE_RGB(256, 90, 90));