how do i get a native scroller to start from the bottom?

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Peter@multidesk.se
Posts: 136
Joined: Fri Oct 14, 2011 6:53 am

how do i get a native scroller to start from the bottom?

Post by Peter@multidesk.se » Sat Dec 22, 2018 3:45 pm

I try to get a native scroller to start from the bottom instead from the top.
I can set the start value with

Code: Select all

set the vScroll of group "theList" to the formattedHeight of group "theList"

but when I touch the control the scroller jumps back to the top of the list
I thought it would be enough to set the VScroll to the formattedHeight of group, but it didn't, of course! :?

How do I prevent this unwanted behavior?


///Peter
/*Whats all the fuss with c# ?*/

Klaus
Posts: 13828
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: how do i get a native scroller to start from the bottom?

Post by Klaus » Sat Dec 22, 2018 4:06 pm

Hi Peter,

you probably also need to set the scroll of your mobile scroller:

Code: Select all

...
put the formattedHeight of group "theList" into tVScroll
set the vScroll of group "theList" to tVScroll
mobilecontrolset "your scroller for the group here","vScroll",tVScroll
...
Out of my head, I do not own any mobile device.


Best

Klaus

Peter@multidesk.se
Posts: 136
Joined: Fri Oct 14, 2011 6:53 am

Re: how do i get a native scroller to start from the bottom?

Post by Peter@multidesk.se » Sat Dec 22, 2018 4:42 pm

Hi Klaus,

Thanks for the suggestion, But I had already tried to set the scroll and it didn't work :(

///Peter
/*Whats all the fuss with c# ?*/

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7230
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: how do i get a native scroller to start from the bottom?

Post by jacque » Sun Dec 23, 2018 7:24 pm

Usually you need to set both the native scroller and the field scroll to zero first, which will align them properly. Then set both scrolls to the position you want to display.

Setting a LC field scroll to its formattedHeight doesn't really do that. LC automatically prevents overscrolling, so the actual scroll is less than the formattedHeight. You probably need to set the native field to the scroll of the LC field, which will be the actual adjusted scroll.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

rolandstauber
Posts: 1
Joined: Fri Mar 08, 2019 3:12 pm

Re: how do i get a native scroller to start from the bottom?

Post by rolandstauber » Tue Mar 12, 2019 8:57 pm

Hi Peter,

I had a similar problem (after deleting and recreating of a scroller) and found the following solution:

1. set the vScroll of your scroller to zero B E F O R E you create the native scroller !!!
2. Now create the scroller and after that use
3. scrollerDidScroll HScroll,YourDesiredVScrollValue
4. mobileControlSet YourScroller, "vscroll", YourDesiredVScrollValue

Try it.
I hope it will work.

Roland.

Charlie Hayes
Posts: 1
Joined: Fri Nov 23, 2018 10:11 am
Contact:

Re: how do i get a native scroller to start from the bottom?

Post by Charlie Hayes » Wed Mar 13, 2019 9:34 am

Note that this scrolls the view completely to the bottom, so the view is essentially not visible (unless you added something to it after the measurement). This makes sense since the code scrolls to the height of the scrollable area, not to the height of children overflowing the scrollable area (probably NOT what OP wanted).

Post Reply

Return to “Android Deployment”