cancel
Showing results for 
Search instead for 
Did you mean: 

force update of scrollbar in scrollableContainer

mip
Associate II

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?

15 REPLIES 15
mip
Associate II

Unfortunately this is not working. I can see in debugging that

	scrollableContainer1.invalidateScrollbars();

is called, but the scrollbars are not consistently updating.

LouisB
ST Employee

Ok, can you send the project by private message ?

Louis BOUDO
ST Software Engineer | TouchGFX
mip
Associate II

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

No problem, if you can make that will be nice.

Louis BOUDO
ST Software Engineer | TouchGFX
JTP1
Lead

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

mip
Associate II

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.