MobileScrollableArea - Trouble getting back to the top

I’m having trouble returning my scrollable area to the top programmatically.
I’ve tried using saving the default position to an App shared Point property using ScrollPositionXC when opening the scrollable area control:
App.ScrollPos=me.ScrollPositionXC

However, this always saves the point (0,0)

If I try to restore this position using:
sa.ScrollToXC(App.ScrollPos,True)=App.ScrollPos

This doesn’t return the MobileScrollableArea (sa) to the home position, but just somewhere close to it. If I check the ScrollPositionXC again with a temporary button, I see the correct Y figure would be -64 or -98.66667 (depending on device) but I don’t appear to be able to capture this value for re-use using Opening events.

I also tried using sa.SetScrollsToTopXC(True) but this doesn’t seem to do anything at all.

Appreciate any advice.

Have you tried after the opening event? It could be that is too early.

That was what I was thinking, but then the question arises of which event to use.
Obviously I have to ensure that the screen hasn’t already scrolled.

SetScrollsToTopXC help message says:

Defines if the Scrollview scrolls to the top when double tapping the time indicator.

Try saving the position 100ms after showing the screen.

In the Opening event:
Timer.CallLater(100, AddressOf SavePosition)

SavePosition method:
App.ScrollPos=scrollControl.ScrollPositionXC

1 Like

Thanks Jeremy - that nearly solved it.
My App has an optional splash screen that the user can switch off. When switched off, your suggestion to use the Timer call worked.

However, when the splash screen temporarily displays in front of the main screen, ScrollPositionXC returns (0,0)

I changed the Screen opening event to just create an initial value:
App.ScrollPos=me.ScrollPositionXC
(if I’m not using the splash screen, this sets it correctly without any timer delay)

I added a 2nd call to the Screen Activated event:
if App.ScrollPos.Y=0 then Timer.CallLater(10, AddressOf SavePosition)

I found it’s not that sensitive to the timer length; 1ms was enough for it to work but I set it to 10.
This solves it for splash screen on or off.

Many thanks