2019-01-25 05:41 AM
How to add item to swipe list when update comes form other event in software.
Now I write something like this:
case ID_SWIPELIST_0:
{
switch(NCode)
{
case WM_NOTIFICATION_CLICKED:
{
printf("ID_SWIPELIST_0: WM_NOTIFICATION_CLICKED\n\r");
break;
}
case WM_NOTIFICATION_RELEASED:
{
int Item, j;
printf("ID_SWIPELIST_0: WM_NOTIFICATION_RELEASED\n\r");
hItem = WM_GetDialogItem(pMsg->hWin, ID_SWIPELIST_0);
Item = SWIPELIST_GetReleasedItem(hItem);
for (j=0;j<16;j++)
{
SWIPELIST_SetBitmap(hItem, j, SWIPELIST_BA_LEFT, NULL);
}
SWIPELIST_SetBitmap(hItem, Item, SWIPELIST_BA_LEFT, &bmplay);
SWIPELIST_AddItem (hItem, "Radio Czworka", 60);
break;
}
case WM_NOTIFICATION_SEL_CHANGED:
{
printf("ID_SWIPELIST_0: WM_NOTIFICATION_SEL_CHANGED\n\r");
break;
}
case WM_NOTIFICATION_USER:
{
int Item;
printf("WM_NOTIFICATION_USER\n\r");
hItem = WM_GetDialogItem(pMsg->hWin, ID_SWIPELIST_0);
SWIPELIST_AddItem (hItem, "Test label", 60);
WM_Update(pMsg->hWin);
break;
}
}
And my event:
void ListAddItem (unsigned char *ucLabel)
{
WM_MESSAGE pMsg;
pMsg.MsgId = WM_NOTIFY_PARENT;
pMsg.hWin = hWin;
pMsg.hWinSrc = WM_GetDialogItem(hWin, ID_SWIPELIST_0);
pMsg.Data.v = WM_NOTIFICATION_USER;
WM_SendMessage (hWin, &pMsg);
}
In this way SWIPELIST component is updte only after use a touchscreen.
I need that new items of list will be displayed after event occure without using of touchscreen.