Skip to main content
Associate
Feb 26, 2025 3:49 PM UTC
Question

Assign a different Scrollbar width to a scrollableContainer

I am working with TouchGFX Designer 4.24.2
If I assign a different Scrollbar width to a scrollableContainer in     Screen1view::setupScreen()
after or before the command     Screen1ViewBase::setup();

      scrollableContainerMainMenu.setScrollbarWidt(50);
      scrollableContainerMainMenu.invalidate();

 

the scrollbar is only 50 pixels wide after you click into the ScrollableContainer.
What do you have to do so that it is displayed in the correct width from the start?

This topic has been closed for replies.

6 replies

GaetanGodart
ST Employee
Feb 28, 2025 9:51 AM UTC

Hello @User2025 and welcome to the community!

 

Simply call 

scrollableContainerName.childGeometryChanged();

and your new scrollbar width will be shown before you even touch the scrollableContainer.

 

If this comment answer your question, I invite you to select it as "best answer".

 

Regards,

Gaetan GodartSoftware engineer at ST (TouchGFX)
GaetanGodart
ST Employee
Mar 13, 2025 10:32 AM UTC

Hello @User2025 ,

 

Have you been able to solve your issue?

 

Regards,

Gaetan GodartSoftware engineer at ST (TouchGFX)
User2025Author
Associate
Mar 25, 2025 6:24 AM UTC

Hello GaetanGodart,

thank you very much for your help. It works well.

I try it with

scrollableContainerMainMenu.doScroll(0, 0);

but this only works with Y values not equal to 0 (e.g. -1).

scrollableContainerMainMenu.doScroll(0, -1);

 

Regards,

GaetanGodart
ST Employee
Mar 25, 2025 9:06 AM UTC

Hello @User2025 ,

 

This seems to be a completely different question here.

scrollableContainerMainMenu.doScroll(x, y) is used to scroll the container up/down and left/right.

Therefore, using 0 as a value will scroll 0 pixels.

So I don't see what is the issue here.

 

Regards,

Gaetan GodartSoftware engineer at ST (TouchGFX)
User2025Author
Associate
Apr 1, 2025 4:51 AM UTC

Hello Gaetan Godart,
I had used the command scrollableContainer.doScroll(0, -1) as a substitute to force a redraw of the scrollbar, but did not realize that (0,0) corresponds to the actual state at the start time and is therefore nonsense.
Many thanks for your help.

GaetanGodart
ST Employee
Apr 1, 2025 9:06 AM UTC

My pleasure @User2025 !

 

Can you select the comment that helped you the most as "best answer"?

 

Regards,

Gaetan GodartSoftware engineer at ST (TouchGFX)