Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

Hi ALL

 

I am facing problem in displaying Image and text using vector model. I have stored the Image+text in image static info structure.. the image as well as text is not displaying, only colur is displaying..

 

Below is the code snippet..

 

 

 

 

       IWidget      *piwChild      = NULL;

   IWidget      *piwList       = NULL;

   IDecorator   *pidList       = NULL;

   IVectorModel *piVectorModel = NULL;

    IModel       *piViewModel   = NULL;

 

       //where piimage has the image and menuname has the text

 

pMe->w.pif.piImage=piimage;

pMe->w.pif.pwText=menuname;

 

ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_ListWidget, (void**) &pidList);

IDecorator_QueryInterface(pidList, AEEIID_IWidget, (void**) &piwList) ;

ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_VectorModel, (void**) &piVectorModel);

ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_ImageStaticWidget, (void**) &piwChild);

 

 

 

result=IVectorModel_Add(piVectorModel, &pMe->w.pif);

IWidget_SetModel(piwList, IVectorModel_to_IModel(piVectorModel)); 

 

  IWidget_SetSelectedFGColor( piwList, MAKE_RGBA(255, 255, 255, 255) );

 

IWidget_SetSelectedActiveBGColor(piwChild,MAKE_RGBA(232, 0,232, 232));

 

IWidget_SetInactiveFGColor (piwChild,MAKE_RGBA(255,255,255,255));

 

IWidget_SetTransparency( piwList, 255 );

//decorating it to the Image static widget

IDecorator_SetWidget(pidList, piwChild);

IWidget_SetItemHeight(piwList, 70);

 

 

IWidget_GetPreferredExtent(piwList,&we);

we.height=70+pMe->Hpos;

we.width=150;

IWidget_SetExtent(piwList,&we);

 

dwpos.x=30;

dwpos.y=70+pMe->Ypos;

dwpos.bVisible=TRUE;

 

result=IRootContainer_Insert(pMe->w.picRoot,piwList,WIDGET_ZNORMAL,&dwpos);

 

please see the code and tell me where i am going worng

Install indexer function on list widget and load the data to imagestaticwidget in it.
IWidget_SetIndexer(pMe->piwlist, ListIndexer, pMe);

void ListIndexer(void *pCtx, int nIndex, boolean bSelected)
{
listwidgetapp *pMe = (listwidgetapp *)pCtx;

if(nIndex >= 0 && nIndex < 3)
{
IWidget *piwItem = NULL;
ImageStaticInfo pisInfo;
listwidgetapp_GetResString(pMe->piResFile,IDS_STR_NAME_1 + nIndex, &pisInfo.pwText);
listwidgetapp_GetResImage(pMe->piResFile,IDI_PHOTO_1 + nIndex, &pisInfo.piImage);
IDecorator_GetWidget((IDecorator*)pMe->piwlist, &piwItem);
IWidget_SetImageStaticInfo(piwItem, &pisInfo, 0);
}

Don't set actual data in vector model; Add only resource ids or just placeholder to let list widget know number of items.

Install indexer function on list widget and load the data to imagestaticwidget in it.
IWidget_SetIndexer(pMe->piwlist, ListIndexer, pMe);

void ListIndexer(void *pCtx, int nIndex, boolean bSelected)
{
listwidgetapp *pMe = (listwidgetapp *)pCtx;

if(nIndex >= 0 && nIndex < 3)
{
IWidget *piwItem = NULL;
ImageStaticInfo pisInfo;
listwidgetapp_GetResString(pMe->piResFile,IDS_STR_NAME_1 + nIndex, &pisInfo.pwText);
listwidgetapp_GetResImage(pMe->piResFile,IDI_PHOTO_1 + nIndex, &pisInfo.piImage);
IDecorator_GetWidget((IDecorator*)pMe->piwlist, &piwItem);
IWidget_SetImageStaticInfo(piwItem, &pisInfo, 0);
}

Don't set actual data in vector model; Add only resource ids or just placeholder to let list widget know number of items.