How to determine someone has finished scrolling a field

Paul Hibbert paul at livecode.org
Sun Nov 8 19:56:50 EST 2015


This seems to work OK as far as I can see…

## In the field script
on scrollBarDrag
   put (the formattedHeight of me) - ((the vScroll of me) + (the height of me)) <= 6
   ## = true when you reach the end of the vertical scroll
end scrollBarDrag

I think 6 is relative to the minimum scroll thumb size, but I may be wrong.

I tried different fonts/sizes, margins, textHeight, field sizes etc. and it seems to be reliable with the limited testing I did.

Not a big problem, but I did discover one slight anomaly, I saw a difference of 1 pixel in the maximum vScroll between dragging the scroll thumb using the mouse button as opposed to using the mouse scroll wheel, so a little tolerance may help.

Paul

> On Nov 8, 2015, at 1:52 PM, Brahmanathaswami <brahma at hindu.org> wrote:
> 
> OLD question.
> 
> What is the algorithm for determining if someone has scrolled all the way to the end of the text of a field with overflow text?
> 
> Another way to say this is: what is the relationship to the vScroll and formattedHeight?
> 
> I'm testing with this
> 
> where the factor "195" is somehow related to the field height
> (which is 178 px high plus the some value related to the lineheight or font size)
> 
> But this seems to work...
> 
> function checkScrollDone
>   put the formattedHeight of fld "quote" into tTextHeight
>   put the vScroll of fld "quote" into tVscroll
>    put tTextHeight - tVscroll into tBalanceToScroll
> put tBalanceToScroll
>   if tBalanceToScroll < 195 then
>        return   "true"
>   else
>      return  "false"
>    end if
> end checkScrollDone
> 
> 
> BR
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list