Front and Back Scripts on Mobile

Sannyasin Brahmanathaswami brahma at hindu.org
Sun Jul 3 00:36:13 EDT 2016


@Richard:

Thanks… confirmed… today it is working, yesterday it was not… go figure.  create scroller and scrollerdidscroll now in our backscript. awesome!

"Instead, a backscript scans controls during preOpenCard and anything
that needs a scroller gets one instantiated for it (along the way it
also turns off scrollbars, since of course those are only useful on
desktop)."

how does your scan "know" that a scroller is needed or not?

And since I would prefer not to have scrollbars even on desktop… I am putting this in to the [field | group] (see below)

I need to find a way to move this also to the back script so that it can work everywhere.. I guess "target" is my friend here. or perhaps this is a case for a behavior, but I'm unable to work out yet how to make this generic because "the target" returns the object under the mouse and not the name of the group that the object is part of.


local sMouseLoc, sStartLoc,

on mouseDown

put the mouseloc into sMouseLoc

put sMouseLoc into sStartLoc

if not isMobile() then setScroll

end if

end mouseDown

on setScroll

if the mouse is down then

lock screen

if item 2 of sMouseLoc > the mouseV then

set the vscroll of me to the vscroll of me - (the mouseV - item 2 of sMouseLoc)

else

set the vscroll of me to the vscroll of me + (item 2 of sMouseLoc - the mouseV)

end if

put the mouseloc into sMouseLoc

send "setScroll" to me in 20 millisec

unlock screen

else

put empty into sMouseLoc

end if

end setScroll



Now… if we can get *this* working from the backscript also for any field/group that needs to scroll, that will be even more awesome.



From: use-livecode <use-livecode-bounces at lists.runrev.com> on behalf of Richard Gaskin <ambassador at fourthworld.com>
Reply-To: How LiveCode <use-livecode at lists.runrev.com>
Date: Saturday, July 2, 2016 at 8:47 AM
To: How LiveCode <use-livecode at lists.runrev.com>
Subject: Re: Front and Back Scripts on Mobile

I believe a more accurate description is that the scrollerDidScroll
message is sent to the *script* that created the scroller, which many
not necessarily be a stack.

In my case it's a backscript, and it works well.

It seemed painfully tedious to even think about typing scroller
instantiation code for every controls that needs it, so I don't.
Instead, a backscript scans controls during preOpenCard and anything
that needs a scroller gets one instantiated for it (along the way it
also turns off scrollbars, since of course those are only useful on
desktop).


More information about the use-livecode mailing list