cancel
Showing results for 
Search instead for 
Did you mean: 

Scroll list add/remove

apll
Associate II

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?

13 REPLIES 13
Martin KJELDSEN
Chief III

Hi @Community member​,

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

/Martin

Yes, i read.

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

The way the callbacks work is allow you to select the next item to add/delete during scroll - This allows us to not allocate all items required for a list but only the visible ones.

apll
Associate II

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
Chief III

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

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...

Hi again,

Just to be completely sure about what you're trying to do, could you visualize it? Drawing or otherwise. What's working for you and what isn't. Screenshots of your running application - What're you expecting? Thanks!

/Martin

This is my screen

0690X000008vzUyQAI.jpg

If i use

if(itemIndex == 0)
     paramScroll.remove(item);

I expecting that first line delete and i see scroll list without first object

0690X000008vzVcQAI.jpg

so what do i wrong?

Thanks for help me.

Thanks. But what is the application doing when

if(itemIndex == 0)
     paramScroll.remove(item);

.. is executed? You're scrolling?