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

Developer

Forums

Forums:

In our app, for tasks we are using list widget. We will add the
items to vector model and finally we will attach vector model to List
Widget. Till here it is fine.

But in tasks, we need to show different items in different colors.
For example overdue tasks in one color, completed tasks in one color. So
is there any way to show different vector items in different colors? I
mean first item in one color, second item in another color? Do we have
control over different items in list widget?

We can set different colors for each item in list widget as well. We
need to specify color for each item in indexer. If we set color for only
one item then that color will be used for all items. Here is the code
snippet for indexer:
void ListIndexer(void *pCtx, int nIndex, boolean bSelected)
{
if(nIndex >= 0 && nIndex < 5)
{
IWidget *piwProp = NULL;
IDecorator_GetWidget((IDecorator*)pMe->piwlist, &piwProp);
if(nIndex == 2)
{
if(piwProp)
{
IWidget_SetActiveBGColor(piwProp, MAKE_RGB(199,0,0));
IWidget_SetSelectedActiveBGColor(piwProp, MAKE_RGB(0,199,0));
}
}
else
{
if(piwProp)
{
IWidget_SetActiveBGColor(piwProp, LIST_UA_RGBA_BACKGROUND);
IWidget_SetSelectedActiveBGColor(piwProp, LIST_SA_RGBA_BACKGROUND);
}
}
}

In above code I tried to set different color for item at index 2.

We can set different colors for each item in list widget as well. We
need to specify color for each item in indexer. If we set color for only
one item then that color will be used for all items. Here is the code
snippet for indexer:
void ListIndexer(void *pCtx, int nIndex, boolean bSelected)
{
if(nIndex >= 0 && nIndex < 5)
{
IWidget *piwProp = NULL;
IDecorator_GetWidget((IDecorator*)pMe->piwlist, &piwProp);
if(nIndex == 2)
{
if(piwProp)
{
IWidget_SetActiveBGColor(piwProp, MAKE_RGB(199,0,0));
IWidget_SetSelectedActiveBGColor(piwProp, MAKE_RGB(0,199,0));
}
}
else
{
if(piwProp)
{
IWidget_SetActiveBGColor(piwProp, LIST_UA_RGBA_BACKGROUND);
IWidget_SetSelectedActiveBGColor(piwProp, LIST_SA_RGBA_BACKGROUND);
}
}
}

In above code I tried to set different color for item at index 2.