Skip to main content
shark
Associate III
March 3, 2020
Question

change ScrollWheel's content dynamicaly

  • March 3, 2020
  • 2 replies
  • 1752 views

When screen initializes:

  scrollWheel1.setNumberOfItems(1);

  scrollWheel1.setDrawables(scrollWheel1ListItems, updateItemCallback,

 scrollWheel1SelectedListItems, updateItemCallback);

After run for some time, scrollWheel is re-configed as:

scrollWheel1.setNumberOfItems(9); // assert() error happened here

scrollWheel1.invalidate();

The error happens at :

ScrollWheelWithSelectionStyle::setNumberOfItems()

 ScrollBase::setNumberOfItems()

DrawableList::setNumberOfItems()

DrawableList::refreshDrawables()

    Container::add(*drawable);

assert(d.parent == 0 && "Cannot add Drawable multiple times");

So can I call setNumberOfItems() dynamically? How to go around?

2 replies

Alexandre RENOUX
Visitor II
August 17, 2020

Hello,

You cannot change ScrollWheel content (add or remove items) dynamically like this. Actually, the current ScrollWheel is not really meant to have items removed or added.

To do so, a ListLayout without a Scrollable container should be easier to implement. Nevertheless, I will see if I have time to create a sort of Scroll Wheel where items can be added and removed more easily.

/Alexandre

JAlbr.1
Associate III
February 5, 2024

Any update on this, @Alexandre RENOUX? Would really love to have a dynamically changeable scroll wheel (in terms of the items in the list.) I have a work around that *almost* works, but there are some quirks with modifying the items in the list. Would be nice to not have to actually work around it and change the contents of the scroll wheel.

Associate
May 13, 2025

Hi @JAlbr.1 ! Could you please explain the workaround to add/remove items dynamically? I would really appreciate it if you share the source code.

Thanks.

scottSD
Senior III
August 17, 2020

@Alexandre RENOUX​ 

I may be interested in this as well. I have been able to change the ScrollWheel content (the strings that make up the elements of the list), but might be interested in also being able to add and remove items to change the size of the list.