Jump to content


Photo

Scroll/Jump to top of Form


  • Please log in to reply
3 replies to this topic

#1 recursiveElk

recursiveElk
  • Members
  • 36 posts

Posted 29 August 2017 - 06:06 AM

Hi,

I have a situation where i have two forms A and B and use GoToForm to transition between them.

I was wondering if there is a way to force it so every time i switch to B its automatically scrolled to the top despite what position i transitioned out of B at (eg halfway down).

i have already tried js solutions like:

asm
window.scrollTo(0,0);
end;

Cheers,

#2 EvaF

EvaF
  • Members
  • 9 posts

Posted 29 August 2017 - 12:23 PM

there is option
...
  var lh := Application.FormByName('Form2').handle;
  asm
    var h =@lh;
    h.scrollIntoView();
  end;
  ...

  • recursiveElk likes this

#3 recursiveElk

recursiveElk
  • Members
  • 36 posts

Posted 29 August 2017 - 11:18 PM

h.scrollIntoView(); doesn't seem to work for me but thanks for the suggestion, i'll look into how i'm generating the Form.

Am i meant to be calling these asm/end functions in FormActivated?

Edit: it seems h.scrollTo(0,0); works for firefox but not on chrome, maybe it's related to a problem like: https://puu.sh/xmGhp/e31030a00f.png
Error: https://puu.sh/xmJHF/378f60a675.png

#4 recursiveElk

recursiveElk
  • Members
  • 36 posts

Posted 12 September 2017 - 05:07 AM

Finally found a solution:
var h := Application.FormByName('Form1').handle;
  asm
      var w =@h;
      w.scrollTop = 0;
  end;





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users