Page 1 of 1

Mobile Scroll vs Web Browser control

Posted: Sat Jan 13, 2018 1:46 am
by Bevan
Hi, I am trying to build a pages with text listings and feeds similar to facebook feeds (images, text, buttons).

I have developed these pages with a mobile scroll and grouping the images, text, buttons together. It can be complex to getting the field placements right and alighted properly. However the issue is its slow on mobile devices, iOS or Android. However if I used a Web Browser control to browser facebook, its fast and smooth.

Any tips on a good mobile scroll code or am I best to develop the pages to html and load via the web browser control. I did want some interaction from clicking on a button and livecode performing an action.

Thanks,
Bevan

Re: Mobile Scroll vs Web Browser control

Posted: Sat Jan 13, 2018 5:31 am
by quailcreek
Hi and welcome to the forum. What code are you using for your scroller?

Re: Mobile Scroll vs Web Browser control

Posted: Sat Jan 13, 2018 8:53 am
by Bevan
Thanks Tom, I have been using Livecode on and off for a year and generally look at the forums and code samples.

I Used some code from an example script from live code some time ago:

Code: Select all

on preOpenCard

   
   local tScrollerRect, tContentRect

   // Only create a scroller on a mobile device
   if environment() is not "mobile" then exit preOpenCard
   
   // Set the area of the scroller
   put the rect of group "scrollArea" into tScrollerRect
   
   // Set the are of the content to be scrolled
   put the left of field "lorem",the top of field "lorem",the right of field "lorem",the formattedHeight of field "lorem" + 5000 into tContentRect
   
   
   
   // Create the scroller control
   mobileControlCreate "scroller", "loremScroll"
   put the result into sScrollerID
   // Set the properties of the scroller
   mobileControlSet "loremScroll", "rect", tScrollerRect
   mobileControlSet "loremScroll", "contentRect", tContentRect
   mobileControlSet "loremScroll", "visible", true
   mobileControlSet "loremScroll", "scrollingEnabled", true
   mobileControlSet "loremScroll", "vIndicator", true
   mobileControlSet "loremScroll", "vscroll", 0
   

   
end preOpenCard

on scrollerDidScroll hOffset, vOffset
   // When the user scrolls move the displayed content
   set the vScroll of group "scrollArea" to vOffset
end scrollerDidScroll

on closeCard
   // Delete the scroller
   if environment() is not "mobile" then exit closeCard
   mobileControlDelete sScrollerID
end closeCard

on scrollerDidScroll hOffset, vOffset
   // When the user scrolls move the displayed content
   set the vScroll of group "scrollArea" to vOffset
end scrollerDidScro

Re: Mobile Scroll vs Web Browser control

Posted: Sat Jan 13, 2018 5:16 pm
by FourthWorld
Is the layerMode of the group set to scrolling?

Re: Mobile Scroll vs Web Browser control

Posted: Sat Jan 13, 2018 5:21 pm
by jacque
In addition to the layermode you also need to set the acceleratedRendering of the stack to true in a preOpenStack or preopencard handler.

Re: Mobile Scroll vs Web Browser control

Posted: Sat Jan 13, 2018 7:29 pm
by quailcreek
Here's sample stack of a grp scroller.
Scrolling Group Test.livecode.zip
(7.24 KiB) Downloaded 289 times

Re: Mobile Scroll vs Web Browser control

Posted: Sun Jan 14, 2018 1:23 am
by FourthWorld
Why isn't acceleratedRendering on by default?

How many developers get up in the morning and say, "Today I want to build an app with slow rendering!"? ;)

Re: Mobile Scroll vs Web Browser control

Posted: Sun Jan 14, 2018 4:42 am
by bogs
< Looking around guiltily > Ok, you got me, I'm the one Richard :oops:

Re: Mobile Scroll vs Web Browser control

Posted: Sun Jan 14, 2018 6:14 pm
by jacque
FourthWorld wrote:
Sun Jan 14, 2018 1:23 am
Why isn't acceleratedRendering on by default?

How many developers get up in the morning and say, "Today I want to build an app with slow rendering!"? ;)
Probably because if there are no moving objects on the card it isn't needed and I assume would do unnecessary scanning for potential buffering. I'd guess that acceleratedRendering isn't needed far more times than it is. There are only three conditions where it improves performance.

Re: Mobile Scroll vs Web Browser control

Posted: Sun Jan 14, 2018 9:14 pm
by FourthWorld
jacque wrote:
Sun Jan 14, 2018 6:14 pm
I'd guess that acceleratedRendering isn't needed far more times than it is. There are only three conditions where it improves performance.
What are those three?

And if we can I identify them, could the engine?

Re: Mobile Scroll vs Web Browser control

Posted: Sun Jan 14, 2018 11:46 pm
by jacque
FourthWorld wrote:
Sun Jan 14, 2018 9:14 pm
What are those three?

And if we can I identify them, could the engine?
I was referring to the three types of layermodes, and I should have said there were only two, since the third is "static" and is the default. The other two, dynamic and scrolling, have to be set by the developer since the engine couldn't identify whether any particular control was going to move at some time.

AcceleratedRendering only affects controls marked as dynamic or scrolling, so having it always on by default is bound to have at least some overhead. As I understand it, the engine scans all controls when opening a card, looking for objects that need to be buffered. Generally the majority of objects are static.

Re: Mobile Scroll vs Web Browser control

Posted: Fri Nov 02, 2018 6:16 am
by rodneyt
For clarity - I built and tested this on my iphone (6S plus) and found that scrolling was smoother with:
set the acceleratedRendering of this stack to true
quailcreek wrote:
Sat Jan 13, 2018 7:29 pm
Here's sample stack of a grp scroller.

Scrolling Group Test.livecode.zip