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.
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.