How to determine someone has finished scrolling a field
Mark Schonewille
m.schonewille at economy-x-talk.com
Sun Nov 8 20:07:44 EST 2015
Hi BR,
Comparing the vScroll and textHeight can be tricky. This handler avoids
using the textHeight and vScroll:
getprop extScrollFinished
put the long id of the target into myTarget
if the number of items of the margins of the target is 4 then
put the last item of the margins of the target into myMargin
else
put (the margins of myTarget) / 2 into myMargin
end if
put the formattedRect of char 1 to -1 of myTarget into myRect
return not ((the last item of myRect) + myMargin > the bottom of
myTarget)
end extScrollFinished
The handler checks that the position of the last character is within the
visible area of the field. If this is true, then the user must have
scrolled far enough to have read the entire text. I don't know if this
also means that the user can't scroll any further, but this should be
sufficient for your purpose.
Kind regards,
Mark Schonewille
http://economy-x-talk.com
https://www.facebook.com/marksch
Buy the most extensive book on the
LiveCode language:
http://livecodebeginner.economy-x-talk.com
Op 11/8/2015 om 22:52 schreef Brahmanathaswami:
> 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