Skip to main content
Visitor II
August 24, 2026
Question

How to Get and Set Scroll Position

  • August 24, 2026
  • 2 replies
  • 29 views
I want to get the scroll position of a ScrollList widget in the view, and also set the scroll position in the view.However, the `setOffset` and `getOffset` functions of `ScrollBase` are protected.How can I get and set the scroll position of a scrolllist?

2 replies

ST Technical Moderator
September 3, 2026

Hello,

you can use:

int16_t getItem(int16_t drawableIndex)
virtual void animateToItem(int16_t itemIndex, int16_t animationSteps =-1)

See ScrollList | TouchGFX Documentation

Associate
September 6, 2026

It’s different, I think he hope create a ScrollBar for ScrollList.

 

One solution is use ScrollLayout, ScrollLayout can do this. But in my case ScrollLayout to slow. if you have a few data ( < 20). It is good idea. 

 

Maybe create a class MYscrollList,  class inheritance from ScrollBase but don’t protect setOffset(), getOffset() can do this.