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

Developer

Forums

Forums:

The code for i amtrying for it

 

int nErr = 0;    IWidget *piShowSearchListItem; WExtent extent; int i = 0;    ImageStaticInfo *imageinfo; IVectorModel *pivm = 0; IWidget *piwChild;    IRootContainer* pcwChild;    IWidget *piwSta;    IModel *piViewModel= NULL; WidgetPos Pos;  WidgetProp pxy;    ImageParm  p;    nErr = ISHELL_CreateInstance(pMe->piShell,AEECLSID_VectorModel,(void*)&pMe->pVectorModel);   if(nErr != AEE_SUCCESS)    {    //return(nErr);    }           nErr = ISHELL_CreateInstance(pMe->piShell, AEECLSID_ListWidget,(void*)&pMe->piwOptionList);   if(nErr != AEE_SUCCESS)    {    //return(nErr);    }   //IDECORATOR_QueryInterface((IDecorator*)pMe->piShowSerchList, AEEIID_WIDGET, (void**)&listContainerWidget);   nErr=ISHELL_CreateInstance(pMe->piShell,AEECLSID_XYContainer,(void**)&pMe->picxRoot);   if(nErr != AEE_SUCCESS)   {   // return(nErr);   }   nErr = IXYCONTAINER_QueryInterface(pMe->picxRoot, AEEIID_WIDGET, (void **)&pMe->piShowSearchListItem);   if(nErr != AEE_SUCCESS)   {   // return(nErr);   }     nErr=ISHELL_CreateInstance(pMe->piShell,AEECLSID_STATICWIDGET,(void **)&pMe->Item.pwStatic_Widget1);   nErr=ISHELL_CreateInstance(pMe->piShell,AEECLSID_STATICWIDGET,(void**)&pMe->Item.pwStatic_Widget2);   nErr=ISHELL_CreateInstance(pMe->piShell,AEECLSID_STATICWIDGET,(void**)&pMe->Item.pwStatic_Widget3);                                //IWidget_GetViewModel(pMe->piwOptionList, &pMe->Item.pValueModel);      // LISTENER_Init(&pMe->ListValueModel, (PFNLISTENER)ValueModelLisner, (void*)pMe);   // IVALUEMODEL_AddListener(pMe->Item.pValueModel,&pMe->ListValueModel);         IWIDGET_SetBorderColor(pMe->piShowSearchListItem,MAKE_RGB(200,200,200));   IWIDGET_SetBorderWidth(pMe->piShowSearchListItem,1);   IWIDGET_SetSelectedBorderColor(pMe->piShowSearchListItem,MAKE_RGB(200,200,200));   IWIDGET_SetItemHeight(pMe->piwOptionList,50);   IWIDGET_SetBGColor(pMe->piwOptionList,MAKE_RGB(255,255,255));   IWIDGET_SetItemWidth(pMe->piwOptionList,pMe->DeviceInfo.cxScreen-1);   IWIDGET_SetFlags(pMe->piwOptionList,IDF_ALIGN_CENTER|IDF_ALIGN_MIDDLE);   IWIDGET_SetFlags(pMe->piwOptionList,LWF_PIXELSCROLL|LWF_LIVESCROLL);         nErr=ISHELL_CreateInstance(pMe->piShell, AEECLSID_ValueModel, (void**)&pMe->Item.pValueModel);      if(nErr != AEE_SUCCESS)    {    //return(nErr);    }        IWIDGET_SetModel(pMe->piShowSearchListItem,IVALUEMODEL_TO_IMODEL(pMe->Item.pValueModel));   LISTENER_Init(&pMe->ListValueModel, (PFNLISTENER)ValueModelLisner, (void*)pMe);   IVALUEMODEL_AddListener(pMe->Item.pValueModel,&pMe->ListValueModel);            {     AECHAR temp [30];    pMe->List_Item[0] = (List_Data*)MALLOC(sizeof(List_Data));           WSTRCPY(temp,(AECHAR*)L"Description2:");    WSTRCPY(pMe->List_Item[0]->pwData2,temp);          WSTRCPY(temp,(AECHAR*)L"Title:2");    WSTRCPY(pMe->List_Item[0]->pwData1,temp);         WSTRCPY(temp,(AECHAR*)L"Rating:2");      WSTRCPY(pMe->List_Item[0]->pwData3,temp);          IVectorModel_Add(pMe->pVectorModel,pMe->List_Item[0]);            IValueModel_SetValue(pMe->Item.pValueModel,(void*)pMe->List_Item[0],0,NULL);          //LISTENER_Init(&pMe->ListValueModel, (PFNLISTENER)ValueModelLisner, (void*)pMe);    //IVALUEMODEL_AddListener(pMe->Item.pValueModel,&pMe->ListValueModel);         //RELEASEIF(pMe->Item.pValueModel);        }              {          AECHAR temp [30];    pMe->List_Item[1] = (List_Data*)MALLOC(sizeof(List_Data));           WSTRCPY(temp,(AECHAR*)L"Description:");    WSTRCPY(pMe->List_Item[1]->pwData2,temp);    //IWIDGET_SetText(pMe->Item.pwStatic_Widget1,pMe->List_Item[1]->pwData2,TRUE);    WSTRCPY(temp,(AECHAR*)L"Title:");    WSTRCPY(pMe->List_Item[1]->pwData1,temp);    //IWIDGET_SetText(pMe->Item.pwStatic_Widget2,pMe->List_Item[1]->pwData1,TRUE);    WSTRCPY(temp,(AECHAR*)L"Rating:");      WSTRCPY(pMe->List_Item[1]->pwData3,temp);       //IWIDGET_SetText(pMe->Item.pwStatic_Widget3,pMe->List_Item[1]->pwData3,TRUE);    IVectorModel_Add(pMe->pVectorModel,pMe->List_Item[1]);      IValueModel_SetValue(pMe->Item.pValueModel,(void*)pMe->List_Item[1],0,NULL);          //LISTENER_Init(&pMe->ListValueModel, (PFNLISTENER)ValueModelLisner, (void*)pMe);    //IVALUEMODEL_AddListener(pMe->Item.pValueModel,&pMe->ListValueModel);                }     //nErr=ISHELL_CreateInstance(pMe->piShell,AEECLSID_STATICWIDGET,(void **)&pMe->Item.pwStatic_Widget1);   //nErr=ISHELL_CreateInstance(pMe->piShell,AEECLSID_STATICWIDGET,(void**)&pMe->Item.pwStatic_Widget2);  // nErr=ISHELL_CreateInstance(pMe->piShell,AEECLSID_STATICWIDGET,(void**)&pMe->Item.pwStatic_Widget3);      {      AECHAR temp [30];    pMe->List_Item[2] = (List_Data*)MALLOC(sizeof(List_Data));           WSTRCPY(temp,(AECHAR*)L"Description:3");    WSTRCPY(pMe->List_Item[2]->pwData2,temp);    //IWIDGET_SetText(pMe->Item.pwStatic_Widget1,pMe->List_Item[2]->pwData2,TRUE);    WSTRCPY(temp,(AECHAR*)L"Title:3");    WSTRCPY(pMe->List_Item[2]->pwData1,temp);    //IWIDGET_SetText(pMe->Item.pwStatic_Widget2,pMe->List_Item[2]->pwData1,TRUE);    WSTRCPY(temp,(AECHAR*)L"Rating:3");      WSTRCPY(pMe->List_Item[2]->pwData3,temp);       //IWIDGET_SetText(pMe->Item.pwStatic_Widget3,pMe->List_Item[2]->pwData3,TRUE);    IVectorModel_Add(pMe->pVectorModel,pMe->List_Item[2]);            IValueModel_SetValue(pMe->Item.pValueModel,(void*)pMe->List_Item[2],0,NULL);          //LISTENER_Init(&pMe->ListValueModel, (PFNLISTENER)ValueModelLisner, (void*)pMe);    //IVALUEMODEL_AddListener(pMe->Item.pValueModel,&pMe->ListValueModel);                 }            IWIDGET_SetModel(piShowSearchListItem, IVALUEMODEL_TO_IMODEL(pMe->Item.pValueModel));            extent.width=150;    extent.height=15;    IWIDGET_SetExtent(pMe->Item.pwStatic_Widget1,&extent);    IWIDGET_SetExtent(pMe->Item.pwStatic_Widget2,&extent);    IWIDGET_SetExtent(pMe->Item.pwStatic_Widget3,&extent);       Pos.bVisible = TRUE;    Pos.x =0;    Pos.y= 0;    //pxy.bVisible = TRUE;    //pxy.prop = 0;    IXYCONTAINER_Insert(pMe->picxRoot,pMe->Item.pwStatic_Widget1,WIDGET_ZNORMAL,&Pos);            Pos.x =0;    Pos.y= 15;    //pxy.prop = 50;    IXYCONTAINER_Insert(pMe->picxRoot,pMe->Item.pwStatic_Widget2,WIDGET_ZNORMAL,&Pos);    //pxy.bVisible = TRUE;    //pxy.prop = 100;    Pos.x = 0;    Pos.y =30;    //pxy.prop = 100;    IXYCONTAINER_Insert(pMe->picxRoot,pMe->Item.pwStatic_Widget3,WIDGET_ZNORMAL,&Pos);   extent.height = pMe->DeviceInfo.cyScreen-40-36;   extent.width  = pMe->DeviceInfo.cxScreen-1;     IWIDGET_SetExtent(pMe->piwOptionList,&extent);           IWIDGET_SetModel(pMe->piwOptionList,IVECTORMODEL_TO_IMODEL(pMe->pVectorModel));   IDecorator_SetWidget(CAST(IDecorator*,pMe->piwOptionList),pMe->piShowSearchListItem);

 void ValueModelLisner(MyApp *pMe, ModelEvent *pEvent){ static int loop=0; //MyApp* pMe = (MyApp*)pUserData;    IValueModel *pivm = 0; List_Data *pFinal= NULL; int *pnLen = NULL; pnLen = (int*)MALLOC(sizeof(int)*2000); if(pEvent->evCode == EVT_MDL_VALUE) {  if(loop < 3)  {   if (SUCCESS == IWIDGET_GetModel(pMe->piShowSearchListItem, AEEIID_VALUEMODEL, (IModel **)(void**) &pivm))   {                      //IWIDGET_SetText(pMe->piwStaticW_Name, data->pStaticW_Name, FALSE);         //IWIDGET_SetText(pMe->piwStaticW_Phone, data->pStaticW_Phone, FALSE);   //IVECTORMODEL_GetAt(pMe->pVectorModel, loop,&pFinal) ;   pFinal =(List_Data*)IVALUEMODEL_GetValue(pMe->Item.pValueModel,pnLen);        IWIDGET_SetText(pMe->Item.pwStatic_Widget1,(AECHAR*)L"ASKSKS1233",FALSE);    IWIDGET_SetText(pMe->Item.pwStatic_Widget2,pFinal->pwData2, FALSE);    IWIDGET_SetText(pMe->Item.pwStatic_Widget3,pFinal->pwData3, FALSE);   loop ++;      }  } }}

Hi,
It's a little tough reading the code, since there isn't any formatting.  However, I think that the issue is due to the value model being used.  The ValueModelListener() isn't using the ValueModel that is returned by IWIDGET_GetModel(). 
 

pFinal =(List_Data*)
IVALUEMODEL_GetValue(pMe->Item.pValueModel,pnLen);
This should be

pFinal =(List_Data*)
IVALUEMODEL_GetValue(pivm,pnLen);
 

 
Regards,
Jason F.

Hi,
It's a little tough reading the code, since there isn't any formatting.  However, I think that the issue is due to the value model being used.  The ValueModelListener() isn't using the ValueModel that is returned by IWIDGET_GetModel(). 
 

pFinal =(List_Data*)
IVALUEMODEL_GetValue(pMe->Item.pValueModel,pnLen);
This should be

pFinal =(List_Data*)
IVALUEMODEL_GetValue(pivm,pnLen);
 

 
Regards,
Jason F.

I am tried with whatever u have said but still the List show the last container data in all rows.

I am tried with whatever u have said but still the List show the last container data in all rows.

No problem.  I'll import your code and do a little massaging this evening.  I'll post the cleaned up version, so you have something concrete to refer to.
 
Regards,
Jason

No problem.  I'll import your code and do a little massaging this evening.  I'll post the cleaned up version, so you have something concrete to refer to.
 
Regards,
Jason

Hi,
The snippet you attached had value models for each of the child widgets in the list item.  I recommend using a value model and listener for the XY Container instead.  In the listener can then get the data being set to the value model and use it to apply to the list item.  Here is a snippet that may help you visualize what should change.
Regards, Jason
 
static
void ListItem_Delete(List_Data *pMe)
{
FREE(pMe->pwData1);
FREE(pMe->pwData2);
FREE(pMe->pwData3);
FREE(pMe);
}

static
AEEResult ListWidget_InitList(ListWidget *pMe)
{
AEEResult nErr;
 
int i = 0;
WidgetPos Pos;
WidgetExtent we;
IValueModel *pValueModel = NULL;
List_Data *data = NULL;
 
// Create the list widget that will wrap a static widget to hold our strings 
ERR_TRY( ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_ListWidget, (
void**) &pMe->piwOptionList) );
 
// Create the vector model that will hold the strings used by the static widget 
 
// contained in the list widget. 
ERR_TRY( ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_VectorModel, (
void**) &pMe->piVectorModel) );
 
// Add data to the vector model 
 
for (i = 0; i < 50; i++)
{
 
char aBuffer[20];
AECHAR awBuffer[20];
 
data = (List_Data*) MALLOC(
sizeof(List_Data));
SNPRINTF(aBuffer,
sizeof(aBuffer), "Title%02X: ", i);
STRTOWSTR(aBuffer, awBuffer,
sizeof(awBuffer));
data->pwData1 = WSTRDUP(awBuffer);
SNPRINTF(aBuffer,
sizeof(aBuffer), "Description%02X: ", i);
STRTOWSTR(aBuffer, awBuffer,
sizeof(awBuffer));
data->pwData2 = WSTRDUP(awBuffer);
SNPRINTF(aBuffer,
sizeof(aBuffer), "Rating%02X: ", i);
STRTOWSTR(aBuffer, awBuffer,
sizeof(awBuffer));
data->pwData3 = WSTRDUP(awBuffer);
(
void) IVectorModel_Add(pMe->piVectorModel, (void*)data);
}
 
// Set the function responsible for freeing up the object 
(
void) IVectorModel_SetPfnFree(pMe->piVectorModel, (PFNNOTIFY)ListItem_Delete);
 
// Attach that vector model with the list widget we created 
ERR_TRY( IWidget_SetModel(pMe->piwOptionList, IVectorModel_to_IModel(pMe->piVectorModel)) );
 
// Create container for item widget 
ERR_TRY( ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_XYContainer,(
void**)&pMe->picxRoot) );
ERR_TRY( IXYContainer_QueryInterface(pMe->picxRoot, AEEIID_IWidget, (
void**)&pMe->piShowSearchListItem) );
ERR_TRY( ISHELL_CreateInstance(pMe->a.m_pIShell,AEECLSID_StaticWidget,(
void**)&pMe->pwStatic_Widget1) );
ERR_TRY( ISHELL_CreateInstance(pMe->a.m_pIShell,AEECLSID_StaticWidget,(
void**)&pMe->pwStatic_Widget2) );
ERR_TRY( ISHELL_CreateInstance(pMe->a.m_pIShell,AEECLSID_StaticWidget,(
void**)&pMe->pwStatic_Widget3) );
we.width=150;
we.height=15;
IWidget_SetExtent(pMe->pwStatic_Widget1,&we);
IWidget_SetExtent(pMe->pwStatic_Widget2,&we);
IWidget_SetExtent(pMe->pwStatic_Widget3,&we);
we.height = 50;
IWidget_SetExtent(pMe->piShowSearchListItem, &we);
Pos.bVisible = TRUE;
 
Pos.x =0;
Pos.y= 0;
IXYContainer_Insert(pMe->picxRoot,pMe->pwStatic_Widget1,WIDGET_ZNORMAL,&Pos);
 
Pos.x =0;
Pos.y= 15;
IXYContainer_Insert(pMe->picxRoot,pMe->pwStatic_Widget2,WIDGET_ZNORMAL,&Pos);
Pos.x = 0;
Pos.y =30;
IXYContainer_Insert(pMe->picxRoot,pMe->pwStatic_Widget3,WIDGET_ZNORMAL,&Pos);
 
we.height = pMe->DeviceInfo.cyScreen-5;
we.width = pMe->DeviceInfo.cxScreen-5;
IWidget_SetExtent(pMe->piwOptionList, &we);
IWidget_SetBorderColor(pMe->piShowSearchListItem,MAKE_RGB(200,200,200));
IWidget_SetBorderWidth(pMe->piShowSearchListItem,1);
IWidget_SetSelectedBorderColor(pMe->piShowSearchListItem,MAKE_RGB(200,0,0));
IWidget_SetItemHeight(pMe->piwOptionList,50);
IWidget_SetBGColor(pMe->piwOptionList,MAKE_RGB(255,255,255));
IWidget_SetItemWidth(pMe->piwOptionList,pMe->DeviceInfo.cxScreen-50);
IWidget_SetFlags(pMe->piwOptionList, IDF_ALIGN_LEFT | IDF_ALIGN_MIDDLE);
IWidget_SetFlags(pMe->piwOptionList, LWF_PIXELSCROLL | LWF_LIVESCROLL);
 
// Set up value model for item widget and listener.  
ERR_TRY( ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_ValueModel, (
void**)&pValueModel) );
IWidget_SetModel(pMe->piShowSearchListItem, IValueModel_to_IModel(pValueModel));
LISTENER_Init(&pMe->mItemListener, (PFNLISTENER)ValueModelListener, (
void*)pMe);
IValueModel_AddListener(pValueModel,&pMe->mItemListener);
 
// Wrap list widget around the list item. 
IDecorator_SetWidget((IDecorator *)(
void*)pMe->piwOptionList, pMe->piShowSearchListItem);
 
ERR_CATCH:
RELEASEIF(pValueModel);
 
return nErr;
}
 
 
static
void ValueModelListener(ListWidget *pMe, ModelEvent *pEvent)
{
IValueModel *pivm = 0;
List_Data *pFinal= NULL;
 
int *pnLen = NULL;
 
 
if(pEvent->evCode == EVT_MDL_VALUE)
{
 
if (SUCCESS == IWidget_GetModel(pMe->piShowSearchListItem, AEEIID_IValueModel, (IModel **)(void**) &pivm))
{
pFinal =(List_Data*)IValueModel_GetValue(pivm,pnLen);
IWIDGET_SetText(pMe->pwStatic_Widget1,pFinal->pwData1,FALSE);
IWIDGET_SetText(pMe->pwStatic_Widget2,pFinal->pwData2, FALSE);
IWIDGET_SetText(pMe->pwStatic_Widget3,pFinal->pwData3, FALSE);
}
}
}

Hi,
The snippet you attached had value models for each of the child widgets in the list item.  I recommend using a value model and listener for the XY Container instead.  In the listener can then get the data being set to the value model and use it to apply to the list item.  Here is a snippet that may help you visualize what should change.
Regards, Jason
 
static
void ListItem_Delete(List_Data *pMe)
{
FREE(pMe->pwData1);
FREE(pMe->pwData2);
FREE(pMe->pwData3);
FREE(pMe);
}

static
AEEResult ListWidget_InitList(ListWidget *pMe)
{
AEEResult nErr;
 
int i = 0;
WidgetPos Pos;
WidgetExtent we;
IValueModel *pValueModel = NULL;
List_Data *data = NULL;
 
// Create the list widget that will wrap a static widget to hold our strings 
ERR_TRY( ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_ListWidget, (
void**) &pMe->piwOptionList) );
 
// Create the vector model that will hold the strings used by the static widget 
 
// contained in the list widget. 
ERR_TRY( ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_VectorModel, (
void**) &pMe->piVectorModel) );
 
// Add data to the vector model 
 
for (i = 0; i < 50; i++)
{
 
char aBuffer[20];
AECHAR awBuffer[20];
 
data = (List_Data*) MALLOC(
sizeof(List_Data));
SNPRINTF(aBuffer,
sizeof(aBuffer), "Title%02X: ", i);
STRTOWSTR(aBuffer, awBuffer,
sizeof(awBuffer));
data->pwData1 = WSTRDUP(awBuffer);
SNPRINTF(aBuffer,
sizeof(aBuffer), "Description%02X: ", i);
STRTOWSTR(aBuffer, awBuffer,
sizeof(awBuffer));
data->pwData2 = WSTRDUP(awBuffer);
SNPRINTF(aBuffer,
sizeof(aBuffer), "Rating%02X: ", i);
STRTOWSTR(aBuffer, awBuffer,
sizeof(awBuffer));
data->pwData3 = WSTRDUP(awBuffer);
(
void) IVectorModel_Add(pMe->piVectorModel, (void*)data);
}
 
// Set the function responsible for freeing up the object 
(
void) IVectorModel_SetPfnFree(pMe->piVectorModel, (PFNNOTIFY)ListItem_Delete);
 
// Attach that vector model with the list widget we created 
ERR_TRY( IWidget_SetModel(pMe->piwOptionList, IVectorModel_to_IModel(pMe->piVectorModel)) );
 
// Create container for item widget 
ERR_TRY( ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_XYContainer,(
void**)&pMe->picxRoot) );
ERR_TRY( IXYContainer_QueryInterface(pMe->picxRoot, AEEIID_IWidget, (
void**)&pMe->piShowSearchListItem) );
ERR_TRY( ISHELL_CreateInstance(pMe->a.m_pIShell,AEECLSID_StaticWidget,(
void**)&pMe->pwStatic_Widget1) );
ERR_TRY( ISHELL_CreateInstance(pMe->a.m_pIShell,AEECLSID_StaticWidget,(
void**)&pMe->pwStatic_Widget2) );
ERR_TRY( ISHELL_CreateInstance(pMe->a.m_pIShell,AEECLSID_StaticWidget,(
void**)&pMe->pwStatic_Widget3) );
we.width=150;
we.height=15;
IWidget_SetExtent(pMe->pwStatic_Widget1,&we);
IWidget_SetExtent(pMe->pwStatic_Widget2,&we);
IWidget_SetExtent(pMe->pwStatic_Widget3,&we);
we.height = 50;
IWidget_SetExtent(pMe->piShowSearchListItem, &we);
Pos.bVisible = TRUE;
 
Pos.x =0;
Pos.y= 0;
IXYContainer_Insert(pMe->picxRoot,pMe->pwStatic_Widget1,WIDGET_ZNORMAL,&Pos);
 
Pos.x =0;
Pos.y= 15;
IXYContainer_Insert(pMe->picxRoot,pMe->pwStatic_Widget2,WIDGET_ZNORMAL,&Pos);
Pos.x = 0;
Pos.y =30;
IXYContainer_Insert(pMe->picxRoot,pMe->pwStatic_Widget3,WIDGET_ZNORMAL,&Pos);
 
we.height = pMe->DeviceInfo.cyScreen-5;
we.width = pMe->DeviceInfo.cxScreen-5;
IWidget_SetExtent(pMe->piwOptionList, &we);
IWidget_SetBorderColor(pMe->piShowSearchListItem,MAKE_RGB(200,200,200));
IWidget_SetBorderWidth(pMe->piShowSearchListItem,1);
IWidget_SetSelectedBorderColor(pMe->piShowSearchListItem,MAKE_RGB(200,0,0));
IWidget_SetItemHeight(pMe->piwOptionList,50);
IWidget_SetBGColor(pMe->piwOptionList,MAKE_RGB(255,255,255));
IWidget_SetItemWidth(pMe->piwOptionList,pMe->DeviceInfo.cxScreen-50);
IWidget_SetFlags(pMe->piwOptionList, IDF_ALIGN_LEFT | IDF_ALIGN_MIDDLE);
IWidget_SetFlags(pMe->piwOptionList, LWF_PIXELSCROLL | LWF_LIVESCROLL);
 
// Set up value model for item widget and listener.  
ERR_TRY( ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_ValueModel, (
void**)&pValueModel) );
IWidget_SetModel(pMe->piShowSearchListItem, IValueModel_to_IModel(pValueModel));
LISTENER_Init(&pMe->mItemListener, (PFNLISTENER)ValueModelListener, (
void*)pMe);
IValueModel_AddListener(pValueModel,&pMe->mItemListener);
 
// Wrap list widget around the list item. 
IDecorator_SetWidget((IDecorator *)(
void*)pMe->piwOptionList, pMe->piShowSearchListItem);
 
ERR_CATCH:
RELEASEIF(pValueModel);
 
return nErr;
}
 
 
static
void ValueModelListener(ListWidget *pMe, ModelEvent *pEvent)
{
IValueModel *pivm = 0;
List_Data *pFinal= NULL;
 
int *pnLen = NULL;
 
 
if(pEvent->evCode == EVT_MDL_VALUE)
{
 
if (SUCCESS == IWidget_GetModel(pMe->piShowSearchListItem, AEEIID_IValueModel, (IModel **)(void**) &pivm))
{
pFinal =(List_Data*)IValueModel_GetValue(pivm,pnLen);
IWIDGET_SetText(pMe->pwStatic_Widget1,pFinal->pwData1,FALSE);
IWIDGET_SetText(pMe->pwStatic_Widget2,pFinal->pwData2, FALSE);
IWIDGET_SetText(pMe->pwStatic_Widget3,pFinal->pwData3, FALSE);
}
}
}

Hi Obsius,
  Thanks for ur reply. 
I am able to get the different result on my static widget
on the rows of  different List but after that the calls  to the
handler letting my application to crash and hence i put this code  to stop the handler
 
 
 

 
static void ValueModelListener(MyApp *pMe, ModelEvent *pEvent){IValueModel *pivm = 0;List_Data *pFinal= NULL;int *pnLen = NULL;static int loop=0;if(pEvent->evCode == EVT_MDL_VALUE){// for my three static widget it is getting //called 9 times after that //9th time this handler function is giving error // I kept this condition because after //9th time the handler function is getting crashed// My values are getting updated in static widgetif(loop<9) {if (SUCCESS == IWidget_GetModel(pMe->piShowSearchListItem, AEEIID_IValueModel, (IModel **)(void**) &pivm)){ pFinal =(List_Data*)IValueModel_GetValue(pivm,pnLen); IWIDGET_SetText(pMe->Item.pwStatic_Widget1,pFinal->pwData1,FALSE); IWIDGET_SetText(pMe->Item.pwStatic_Widget2,pFinal->pwData2, FALSE); IWIDGET_SetText(pMe->Item.pwStatic_Widget1,pFinal->pwData3, FALSE); loop++;}}}}}
 
I want your help why my application is getting crashed once handler function is called 9 times . I copied the same code you replied on the post. Please help me.
 
regards
Dinesh

Hi Obsius,
  Thanks for ur reply. 
I am able to get the different result on my static widget
on the rows of  different List but after that the calls  to the
handler letting my application to crash and hence i put this code  to stop the handler
 
 
 

 
static void ValueModelListener(MyApp *pMe, ModelEvent *pEvent){IValueModel *pivm = 0;List_Data *pFinal= NULL;int *pnLen = NULL;static int loop=0;if(pEvent->evCode == EVT_MDL_VALUE){// for my three static widget it is getting //called 9 times after that //9th time this handler function is giving error // I kept this condition because after //9th time the handler function is getting crashed// My values are getting updated in static widgetif(loop<9) {if (SUCCESS == IWidget_GetModel(pMe->piShowSearchListItem, AEEIID_IValueModel, (IModel **)(void**) &pivm)){ pFinal =(List_Data*)IValueModel_GetValue(pivm,pnLen); IWIDGET_SetText(pMe->Item.pwStatic_Widget1,pFinal->pwData1,FALSE); IWIDGET_SetText(pMe->Item.pwStatic_Widget2,pFinal->pwData2, FALSE); IWIDGET_SetText(pMe->Item.pwStatic_Widget1,pFinal->pwData3, FALSE); loop++;}}}}}
 
I want your help why my application is getting crashed once handler function is called 9 times . I copied the same code you replied on the post. Please help me.
 
regards
Dinesh

My app is able to iterate through the 50 entries in the vector model.  The list widget is able to display each one of them without issue.  You may need to spend some time debugging your app.
 
Regards,
Jason

My app is able to iterate through the 50 entries in the vector model.  The list widget is able to display each one of them without issue.  You may need to spend some time debugging your app.
 
Regards,
Jason

Hi,
I have created a list in which i am creating the three static widgets.When i handled any of this three static widgets i am not getting any response.So how to handle this widgets which are inserted in the list.
so please give me the solution for it
regards,
Dinesh

Hi,
I have created a list in which i am creating the three static widgets.When i handled any of this three static widgets i am not getting any response.So how to handle this widgets which are inserted in the list.
so please give me the solution for it
regards,
Dinesh

Can you please elaborate what eaxctly you are looking for? You have list of three items, each item is a static widget...right? what do you mean by response on handling three static widgets? do you mean selecting an item and displaying something?

Can you please elaborate what eaxctly you are looking for? You have list of three items, each item is a static widget...right? what do you mean by response on handling three static widgets? do you mean selecting an item and displaying something?

Hi,
No i have list item in which each item having three static widgets & i want to handle the indivusal Static Widget in that list item so please help me
 
regards,
Dinesh

Hi,
No i have list item in which each item having three static widgets & i want to handle the indivusal Static Widget in that list item so please help me
 
regards,
Dinesh

Hi,
No i have list item in which each item having three static widgets & i want to handle the indivusal Static Widget in that list item so please help me
 
regards,
Dinesh

Hi,
No i have list item in which each item having three static widgets & i want to handle the indivusal Static Widget in that list item so please help me
 
regards,
Dinesh

You cannot select/focus individual static widget, the item widget (some container holding 3 static widgets) can be selected/focused. I don't know which container you are using for each item but if you want to access each static widget of the item, below code snippet may help you:
Install value model listener on the item container ( prop container with static and radio widget, in my case):
ISHELL_CreateInstance(pMe->piShell, AEECLSID_ValueModel, (void**)&pValueModel);
IWidget_SetModel(piwPropCnt, IValueModel_to_IModel(pValueModel));
LISTENER_Init(&pMe->mItemListener, (PFNLISTENER)ValueModelListener, (void*)pMe);
IValueModel_AddListener(pValueModel,&pMe->mItemListener);

Value model listener callback function:
static void ValueModelListener(listwidgetapp *pMe, ModelEvent *pEvent)
{
IPropContainer *picProp = NULL;
IWidget *piwProp = NULL;
IWidget *piwRadio = NULL;
IWidget *piwStatic = NULL;

if(pEvent->evCode == EVT_MDL_VALUE)
{
AECHAR *pszText = NULL;
int nLen;

IDecorator_GetWidget((IDecorator*)pMe->piwlist, &piwProp);
if (piwProp)
{
IWidget_QueryInterface(piwProp, AEEIID_IPropContainer, &picProp);
if (picProp)
{
piwRadio = IPropContainer_GetWidget(picProp, NULL, TRUE, FALSE);
piwStatic = IPropContainer_GetWidget(picProp, piwRadio, TRUE, FALSE);
}
}
RELEASEIF(picProp);
pszText = (AECHAR *)IValueModel_GetValue((IValueModel *)pEvent->pModel, &nLen);

if(piwStatic)
{
//do something
}
if(piwRadio)
{
//do something
}
}

You cannot select/focus individual static widget, the item widget (some container holding 3 static widgets) can be selected/focused. I don't know which container you are using for each item but if you want to access each static widget of the item, below code snippet may help you:
Install value model listener on the item container ( prop container with static and radio widget, in my case):
ISHELL_CreateInstance(pMe->piShell, AEECLSID_ValueModel, (void**)&pValueModel);
IWidget_SetModel(piwPropCnt, IValueModel_to_IModel(pValueModel));
LISTENER_Init(&pMe->mItemListener, (PFNLISTENER)ValueModelListener, (void*)pMe);
IValueModel_AddListener(pValueModel,&pMe->mItemListener);

Value model listener callback function:
static void ValueModelListener(listwidgetapp *pMe, ModelEvent *pEvent)
{
IPropContainer *picProp = NULL;
IWidget *piwProp = NULL;
IWidget *piwRadio = NULL;
IWidget *piwStatic = NULL;

if(pEvent->evCode == EVT_MDL_VALUE)
{
AECHAR *pszText = NULL;
int nLen;

IDecorator_GetWidget((IDecorator*)pMe->piwlist, &piwProp);
if (piwProp)
{
IWidget_QueryInterface(piwProp, AEEIID_IPropContainer, &picProp);
if (picProp)
{
piwRadio = IPropContainer_GetWidget(picProp, NULL, TRUE, FALSE);
piwStatic = IPropContainer_GetWidget(picProp, piwRadio, TRUE, FALSE);
}
}
RELEASEIF(picProp);
pszText = (AECHAR *)IValueModel_GetValue((IValueModel *)pEvent->pModel, &nLen);

if(piwStatic)
{
//do something
}
if(piwRadio)
{
//do something
}
}

Hi,
I am creating the list widget in which i set the list item as XYContainer and in XYContiner i added the Html Widget and i set the ISource in valuemodellistener with help of IDocModel_LoadSource.
The Problem is i am not able to view any data in the list widget.
but when i creating simple html Widget and attach the doc model to it its giving the o/p.
Is that limitation of list widget?
Regards,
Dinesh Bardepur.
 

Hi,
I am creating the list widget in which i set the list item as XYContainer and in XYContiner i added the Html Widget and i set the ISource in valuemodellistener with help of IDocModel_LoadSource.
The Problem is i am not able to view any data in the list widget.
but when i creating simple html Widget and attach the doc model to it its giving the o/p.
Is that limitation of list widget?
Regards,
Dinesh Bardepur.
 

Hi,
I am waiting for response.
 
regards,
Dinesh

Hi,
I am waiting for response.
 
regards,
Dinesh

I would probably recommend not using the HTML widget in a list item for the list wiget due to the EFS overhead loading the content.  I would at least suggest using the list container.  Can rich text be used instead?  Why use the HTML widget in this case?

I would probably recommend not using the HTML widget in a list item for the list wiget due to the EFS overhead loading the content.  I would at least suggest using the list container.  Can rich text be used instead?  Why use the HTML widget in this case?

Hi,
Thank u for reply,
We Got the result with sam Rich Text Widget.
Thanks.
Regards,
Dinesh Bardepur.

Hi,
Thank u for reply,
We Got the result with sam Rich Text Widget.
Thanks.
Regards,
Dinesh Bardepur.