This is what works for me. Note the commented out answer dialog of the 
scroller. Uncomment it so you know the message path is correct. I think you are 
missing==> [mobileControlSet sName , "scrollingEnabled" , true]


command CreateScroll sName
   local crect
   
   if dev () then exit CreateScroll
   put (the rect of control sName) onto crect
   
   mobileControlCreate "scroller", sName
   mobileControlSet sName , "rect", crect
   mobileControlSet sName , "visible",  false   
end CreateScroll

command ActivateScroll sName , Xscroll , Yscroll
   Local crect , sRect
   
   if dev () then exit ActivateScroll
   put  ("0,0," & (the formattedwidth of control sName) & "," & the 
formattedheight of control sName + 20 ) into sRect
   mobileControlSet sName , "contentRect" ,  sRect
   mobileControlSet sName , "vIndicator" , true
   mobileControlSet sName , "scrollingEnabled" , true
   mobileControlSet sName , "visible", true
   if Xscroll is not empty and Xscroll >= 0 then
      mobileControlSet sName , "hScroll" , round(Xscroll)
   end if
   if Yscroll is not empty and Yscroll >= 0 then
      --answer sName , Xscroll , Yscroll
      mobileControlSet sName , "vScroll" , round(Yscroll)
   end if
   
end ActivateScroll

on scrollerDidScroll hScrolled, vScrolled
   local ControlID
   --answer "Here!"
   try
      put mobileControlTarget() into ControlID
      set the vscroll of control ControlID of stack "xxx" to vscrolled
      set the hscroll of control ControlID of stack "xxx" to hscrolled
   end try
   pass scrollerDidScroll
end scrollerDidScroll

Ralph DiMola
IT Director
Evergreen Information Services
rdim...@evergreeninfo.net


-----Original Message-----
From: use-livecode [mailto:use-livecode-boun...@lists.runrev.com] On Behalf Of 
Sannyasin Brahmanathaswami
Sent: Tuesday, July 05, 2016 6:05 PM
To: How to use LiveCode
Subject: Re: Front and Back Scripts on Mobile

Hmmm, today it's not working… not sure how to debug… but buildomh on stand 
alone with this in the backscript


command CreateScroller pName -- scrolling regions,groups, fields

if not isMobile() then exit CreateScroller

deleteMobileControl pName -- delete any existing

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 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

is failing… the control will not scroll


From: use-livecode <use-livecode-boun...@lists.runrev.com> on behalf of Richard 
Gaskin <ambassa...@fourthworld.com>
Reply-To: How LiveCode <use-livecode@lists.runrev.com>
Date: Saturday, July 2, 2016 at 8:47 AM
To: How LiveCode <use-livecode@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).


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to