set scroll position for a scrollView

thierryg

08-06-2016 11:58:01

Hi,

I would like to scroll a scrollView to show the current selected item, but I can't find how.
Sometimes, the current item is out of the window, and it's not clear for the user that he must scroll the window in order to find it.

The idea is :
. when I show a scrollView, I set the scroll position to center the current (=selected) item. I know what item is selected, and the scroll position by code, I just don't know how to scroll the scrollView by code.

Hope that makes sense...

Thierry

Altren

08-06-2016 23:36:08

You should use setViewOffset(const IntPoint& _value). And getViewOffset to get current one.

thierryg

09-06-2016 14:10:03

Thanks !
Perfect :)

T.