Reset scrolling when changing to a new form

Hi,

I use built-in scrolling function in my app and it almost works fine. The problem is, when I scroll down and click a button, a new form opens as it supposed to be but new form opens as it is scrolled down. Is there a way to reset scrolling when opening another form within the app. I tried to use;

Function Form3_onshow()
  window.scrollTo(0,0)
End Function

But this did not work. Appreciate your help, best…

How are you opening the new form?

Hi,
I open with changeForm();

Function button_onclick()
ChangeForm(Form3)
End Function

I do like this and it opens the new form but with a scrolled way

By built in scrolling, do you mean iScroll or native scrolling?

I mean Native Scrolling

I mean Native Scrolling

I’m guessing here, but try putting a delay in:

setTimeout("window.scrollTo(0,0)", 500)

I’m sorry but, this does not work :slightly_frowning_face:

I’m sorry but, this does not work :slightly_frowning_face:

Even in order to test “window.scrollTo(0,0)” I put a button at the buttom of the page and on click to button execute “window.scrollTo(0,0)”. This did not work either, I think “window.scrollTo(0,0)” is not working for native scrolling, do you have any alternative ideas?

I use the following when changing forms. Seems to work for me. Maybe there is something different about using setTimeout(“window.scrollTo(0,0)”, 500)

frmHome.show() 'note if using fadin/slidedown, etc use a longer time interval than what is used in the fade/slide

 TS = SetTimeout(HomeToTop,200)

Function HomeToTop()
  ClearTimeout(TS)
  window.scrollTo(0,0)
End Function  

John

I tried this also but did not work either. @AppStudioSupport Do you have any other suggestions about this, I can send the project file if you want.

Managed to figure out. Method is scrollIntoView(). Not totally true but saved the day.