ShowView and scroll to bottom?


Harald Schneider

Is it possible to call ShowView and, when the complete view has been loaded, scroll to its bottom?

Background for this question:

I have a menu list where each entry loads another view. When I go back from that view to the menu, I have often to scroll manually down to resume the position before.


DecSoft

Hello Harald,

I think we can resume what to do with this: 1º Save the "scrollTop" of the element that we wanted, and then go to another view. 2º When the first view is shown, look at the value of the saved "scrollTop", and, goto it if we have a value different than zero, for example.

Based in the app sample that I prepare before in this thread, I modify it a bit in order to do what I describe above. Please, take a look Harald: copy the below code into a new file and save it as "MyApp.ab", then, open it with DecSoft App Builder and run it.

The "saved scroll top" variable is defined in the app's Ready event with a zero value. When we click the "Go to view 2" button (in the first view) we store the "scroll top" of the element that we wanted (the view itself in this case) in the referred variable. Then, look at the Show event of the first view: we check the value of the referred variable, and, if it's different than zero, we apply the scroll over the view.



Harald Schneider
Perfect! Works like a charm!

Thank you again for your excellent support!

Everybody can read the DecSoft support forum for learning purposes, however only DecSoft customers can post new threads. Purchase one or more licenses of some DecSoft products in order to give this and other benefits.

This website uses some useful cookies to store your preferences.

I agree. Hide this note. Give me more information.