PDA

View Full Version : Reset Panel Scroll Position



aguerra10
9 Jan 2012, 9:35 AM
Hi,

I am trying to reset the scroll position of a panel but cannot make it work.

Here is my code:
myPanel.getScrollable().getScroller().position = {x:0, y:0};

This is definetly not working. What am I doing wrong?

Thanks!!!

aguerra10
9 Jan 2012, 10:07 AM
It seems that this code works but not completly. The scroll position goes back to the start once I scroll, but not automatically. Seems that some sort of "refresh", "update" or something like that method is missing.. This method must be being called when I scroll...

Help please!!

Thanks!!

vitorgomes
10 Jan 2012, 3:20 AM
Hi,
I am also investigating how to control the scroller programatically and found this undocumented method in the source code. I am not sure if it's reliable to use though.

myPanel.getScrollable().getScroller().scrollToAnimated(0,0)
Cheers
Vitor

aguerra10
10 Jan 2012, 4:43 AM
Hi Vitor,

Unfortunately that did not work either, but thanks!! Still looking for a solution then..

Cheers!!

Agustin.

aguerra10
10 Jan 2012, 10:14 AM
Hi,

I just wanted to tell you that I've solved it.

This code is working for me...


myPanel.getScrollable().getScroller().scrollTo({x: 0, y: 0}, true);
myPanel.getScrollable().getScroller().refresh();

Thanks!!

Agustin.

aflx
15 Jan 2012, 9:11 AM
Works great!
Thank you.