cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the instance from scrollList?

Wrend.1
Senior

Now, the way I only know is to get the instance in virtual function "scrollList1UpdateItem" like this:

virtual void scrollList1UpdateItem(selection2& item, int16_t itemIndex)
{
	item.setIcon(itemIndex);		
}

Is there another way to get it from scrollList?

By the way, I see the ScrollList have a function named "getItem", the code of it like this:

 int16_t getItem(int16_t drawableIndex)
{
    return list.getItemIndex(drawableIndex);
}

Under what conditions will it be used?

1 ACCEPTED SOLUTION

Accepted Solutions
Alexandre RENOUX
Principal

Hello,

ScrollList and scrollwheel were not designed to be customized that much and are optimized for specific cases such as the ScrollWheel and ScrollList Example available in Designer.

scrollListUpdateItem() is the function that will interact with the items. There's no other simple way.

If you want to get the item easily, I would suggest instead to go for a ListLayout inside a Scrollable container.

The getItem() function will not be helpful because it will return only the index of the item in the list and not its instance.

/Alexandre

View solution in original post

4 REPLIES 4
Alexandre RENOUX
Principal

Hello,

ScrollList and scrollwheel were not designed to be customized that much and are optimized for specific cases such as the ScrollWheel and ScrollList Example available in Designer.

scrollListUpdateItem() is the function that will interact with the items. There's no other simple way.

If you want to get the item easily, I would suggest instead to go for a ListLayout inside a Scrollable container.

The getItem() function will not be helpful because it will return only the index of the item in the list and not its instance.

/Alexandre

Thank you for answering my questions.

And I have another question. what is the "Initial Selected Item" in ScrollWheel configuration?

As the name states, it specifies which item is selected first.

https://support.touchgfx.com/docs/development/ui-development/ui-components/containers/scroll-wheel/

/Alexandre