Front and Back Scripts on Mobile

Sannyasin Brahmanathaswami brahma at hindu.org
Tue Jul 5 23:21:38 EDT 2016


See other post… the dictionary says

Optional string to use to identify the control. The controlName must be unique amongst all existing controls and cannot be an integer.

so I set the name of the group of links on 

Stack A home.livecode | card 1 | group "portal-links"
  on open card
      createScroller "portal-links"

Stack B surprise-me.livecode t| card 2 | group "surprise-links"  


on open card
      createScroller "surprise-links"

things improved somewhat…

It does not matter whether I use this or Ralph's code (I did set the scrollingEnabled)
And it does not matter whether if we put this in the back script or duplicate it in each stack script (not ideal.. but just to test…)

go stack 1 # from button on Stack 0 -- scroller on stack 1 scrolls
go stack 2 # from button on stack 1 -- scroller on stack 2 scrolls
go stack 1 # from button on stack 2 -- scroller on stack 1 no longer scrolls
go stack 2 # from button on stack 1 - scroller continues to scroll now on stack 2

ergo the scroller on Card 1 | Stack A  "group "portal-links"  has been deleted.

theoretically on desktop, one would trap "resume stack" in the stack being re-activated. but "resume stack" is not amessage that fires on mobile… so when switching between stacks on mobile that are, presumably, still open in memory, how to fire a script in the stack being re-activated? (assuming this is the solution… to the scrolling problem we would delete and re-create the scroller on the fly, though this seems overkill…I don't see anything in the dictionary that says we cannot have multiple mobile scrollers open and funcational at the same time… though perhaps this is mandated but no documented? 


command CreateScroller pName -- scrolling regions,groups, fields
if not isMobile() then exit CreateScroller
deleteMobileControl pName -- delete any existing
# it also doesn't help to comment out the above line…
put (the rect of control pName) into tRect
mobileControlCreate "scroller", pName
mobileControlSet pName, "rect", tRect
put ("0,0," & (the formattedwidth of control pName) & "," & the formattedheight of control pName) into tRect
mobileControlSet pName, "contentRect" , tRect
mobileControlSet pName, "hScroll" , 0
mobileControlSet pName, "vScroll" , 0
mobileControlSet pName, "hIndicator" , false
mobileControlSet sName , "scrollingEnabled" , true
mobileControlSet pName, "visible", true
end CreateScroller
on scrollerDidScroll hScrolled, vScrolled
put mobileControlTarget() into tControlID
set the vscroll of control tControlID to vscrolled
pass scrollerDidScroll
end scrollerDidScroll





More information about the use-livecode mailing list