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-18 2:00 AM - edited 2025-08-18 2:00 AM
Hello @mip,
Have you tried to do :
scrollableContainer1.invalidate();
BR,
2025-08-18 2:04 AM
Hello @LouisB
Yes i invalidate the listLayout and the scrollableContainer every time i add, remove or insert an element.
Mikkel
2025-08-18 2:35 AM
When you say "The scrollbar will only update when the user starts scrolling through the new content", you mean scrolling through the listLayout that is inside the scrollableContainer ?
2025-08-18 2:40 AM
yes, the listlayout can contain more menu buttons than can be shown on screen, therefore i have the listLayout inside a scrollableContainer.
After updating the listLayout the scrollBar of the scrollableContainer is not updated. Only when i touch the scrollableContainer, the scrollBar is updated.
2025-08-18 2:47 AM - edited 2025-08-18 2:48 AM
The scrollbars are also updated if you touch the scrollable container where there's not the listLayout and are you using permanent scrollbars ?
2025-08-18 2:54 AM
I have:
scrollableContainer1.setScrollbarsPermanentlyVisible();
2025-08-18 4:06 AM
And are The scrollbars updated if you touch the scrollable container where there's not the listLayout ?
2025-08-18 9:50 PM
I just tested. The scrollbars updates when i touch the scrollabeContainer where there no listLayout.
2025-08-19 12:45 AM
Can you try to edit this file <Project-folder>/touchgfx/framework/include/touchgfx/containers/ScrollableContainer.hpp:
search for :
/** Invalidate the scrollbars. */
void invalidateScrollbars();
move it so its a public function and call it to force scrollbar invalidation.