How to determine someone has finished scrolling a field
m.schonewille at economy-x-talk.com
Sun Nov 8 20:07:44 EST 2015
Comparing the vScroll and textHeight can be tricky. This handler avoids
using the textHeight and vScroll:
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
put (the margins of myTarget) / 2 into myMargin
put the formattedRect of char 1 to -1 of myTarget into myRect
return not ((the last item of myRect) + myMargin > the bottom of
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.
Buy the most extensive book on the
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
> 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"
> return "false"
> end if
> end checkScrollDone
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
More information about the use-livecode