Mobile Scroll vs Web Browser control

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

Post Reply
Bevan
Posts: 3
Joined: Sat Jan 13, 2018 1:37 am

Mobile Scroll vs Web Browser control

Post by Bevan » Sat Jan 13, 2018 1:46 am

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

quailcreek
Posts: 729
Joined: Sun Feb 04, 2007 11:01 pm
Location: McKenna, WA

Re: Mobile Scroll vs Web Browser control

Post by quailcreek » Sat Jan 13, 2018 5:31 am

Hi and welcome to the forum. What code are you using for your scroller?
Tom
MacBook Pro OS Mojave 10.14

Bevan
Posts: 3
Joined: Sat Jan 13, 2018 1:37 am

Re: Mobile Scroll vs Web Browser control

Post by Bevan » Sat Jan 13, 2018 8:53 am

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

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6236
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Mobile Scroll vs Web Browser control

Post by FourthWorld » Sat Jan 13, 2018 5:16 pm

Is the layerMode of the group set to scrolling?
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4706
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Mobile Scroll vs Web Browser control

Post by jacque » Sat Jan 13, 2018 5:21 pm

In addition to the layermode you also need to set the acceleratedRendering of the stack to true in a preOpenStack or preopencard handler.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

quailcreek
Posts: 729
Joined: Sun Feb 04, 2007 11:01 pm
Location: McKenna, WA

Re: Mobile Scroll vs Web Browser control

Post by quailcreek » Sat Jan 13, 2018 7:29 pm

Here's sample stack of a grp scroller.
Scrolling Group Test.livecode.zip
(7.24 KiB) Downloaded 34 times
Tom
MacBook Pro OS Mojave 10.14

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6236
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Mobile Scroll vs Web Browser control

Post by FourthWorld » 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!"? ;)
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

bogs
Posts: 2389
Joined: Sat Feb 25, 2017 10:45 pm

Re: Mobile Scroll vs Web Browser control

Post by bogs » Sun Jan 14, 2018 4:42 am

< Looking around guiltily > Ok, you got me, I'm the one Richard :oops:
Image

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4706
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Mobile Scroll vs Web Browser control

Post by jacque » Sun Jan 14, 2018 6:14 pm

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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6236
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Mobile Scroll vs Web Browser control

Post by FourthWorld » Sun Jan 14, 2018 9:14 pm

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?
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4706
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Mobile Scroll vs Web Browser control

Post by jacque » Sun Jan 14, 2018 11:46 pm

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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

rodneyt
Posts: 20
Joined: Wed Oct 17, 2018 7:32 am

Re: Mobile Scroll vs Web Browser control

Post by rodneyt » Fri Nov 02, 2018 6:16 am

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

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”