2025-08-13 11:50 PM
I have made a dynamic menu made with a listLayout with a number of buttons inside a scrollableContainer. When a user push the buttons the listLayout is updated with new content.
I have not been able to have the scrollbar reflect the size of the listLayout after the listLayout is updated. The scrollbar will only update when the user starts scrolling through the new content. Until then it reflect the precious size of the listLayout.
I have tried:
scrollableContainer1.doScroll(0, 180);
Thinking it would have the same effect as the user scrolling the scrollableContainer, but it does not work.
Is there a way to force update of the scrollbar?
2025-08-19 1:13 AM
Unfortunately this is not working. I can see in debugging that
scrollableContainer1.invalidateScrollbars();
is called, but the scrollbars are not consistently updating.
2025-08-19 2:54 AM
Ok, can you send the project by private message ?
2025-08-20 2:38 AM
I can’t send the project to you, as it involves custom hardware and is subject to confidentiality restrictions.
I can make a demonstration of the problem on a development board. I have a STM32U5G9J-DK2. Will that be fine?
Mikkel
2025-08-20 6:08 AM
No problem, if you can make that will be nice.
2025-08-21 2:31 AM
Hi Mip
You could also try to call doScroll with negative Y delta value, its needed if you want to scroll the content up.
scrollableContainer1.doScroll(0, -180);
Hope this helps.
Br JTP
2025-09-01 2:11 AM
I have made an example project showing that the scrollbar is not consistently updating.
Next i tried making
/** Invalidate the scrollbars. */ void invalidateScrollbars();
public in my example and calling it when the menu updated. This fixed the problem in my example, but it will not solve the problem in the larger project i am working on.
I have to spend some time figuring out what the difference between my project and the example i constructed, since your fix is working in one case and not in another.