Skip to main content
Wrend.1
Associate III
September 30, 2020
Solved

How to get the instance from scrollList?

  • September 30, 2020
  • 4 replies
  • 1367 views

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?

This topic has been closed for replies.
Best answer by Alexandre RENOUX

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

4 replies

Alexandre RENOUX
Alexandre RENOUXBest answer
Visitor II
September 30, 2020

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

Wrend.1
Wrend.1Author
Associate III
October 10, 2020

Thank you for answering my questions.