Skip to main content
apll
Associate II
May 3, 2019
Question

Scroll list add/remove

  • May 3, 2019
  • 13 replies
  • 3422 views

Hi everyone,

i would remove or add a object in a scroll list

I try to use

paramScroll.remove(*paramScrollListItems.getDrawable(0));
paramScroll.add(*paramScrollListItems.getDrawable(5));

but it don't work.

paramScrollListItems is a DrawableListItems.

How can i do this function in a scroll list?

This topic has been closed for replies.

13 replies

Martin KJELDSEN
Principal III
May 7, 2019

Hi @Community member​,

Have you read this article on Scroll List? https://touchgfx.zendesk.com/hc/en-us/articles/360018095032-Scroll-List

/Martin

apll
apllAuthor
Associate II
May 9, 2019

Yes, i read.

So if i want remove/add an object i must use the callback is invoked when an item has been clicked?

apll
apllAuthor
Associate II
May 14, 2019

This is max number of object in my list

paramScroll.setNumberOfItems(11);

instead this is the function linked with item -> updateItemCallback

paramScroll.setDrawables(paramScrollListItems, updateItemCallback);

i override updateItemCallback that it is called every time change sometime but i don't understand how i can add/remove object...

Can you write an example?

Martin KJELDSEN
Principal III
May 16, 2019

Hi @Community member​,

Please check out the ScrollableList and Wheel example from within the designer. You'll see examples of how to set the update-item-callbacks in the baseclass and how to go about their implementation.

Hope that helps,

Martin

apll
apllAuthor
Associate II
May 16, 2019

Hi Martin,

i understand how set attribute of item but i don't know how remove or add item from scrollList

void InkjetMenuView::paramScrollUpdateItem(RecordInkject& item, int16_t itemIndex)
{
 switch (itemIndex)
 {
		case 0:
		{
			item.updateTextParam(T_PVFIRE);
			item.updateTextValue(IPLINK_HeadData[headShow].vFire);
			item.setId(0);
			break;
		}
...

i try to use

paramScroll.remove(item);

inside a function of scrollList but it doesn't work...