Mobile Scroll vs Web Browser control
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Mobile Scroll vs Web Browser control
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
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
-
- Posts: 746
- Joined: Sun Feb 04, 2007 11:01 pm
- Location: McKenna, WA
Re: Mobile Scroll vs Web Browser control
Hi and welcome to the forum. What code are you using for your scroller?
Tom
MacBook Pro OS Mojave 10.14
MacBook Pro OS Mojave 10.14
Re: Mobile Scroll vs Web Browser control
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:
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
-
- VIP Livecode Opensource Backer
- Posts: 9842
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Mobile Scroll vs Web Browser control
Is the layerMode of the group set to scrolling?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 7237
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Mobile Scroll vs Web Browser control
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
HyperActive Software | http://www.hyperactivesw.com
-
- Posts: 746
- Joined: Sun Feb 04, 2007 11:01 pm
- Location: McKenna, WA
Re: Mobile Scroll vs Web Browser control
Here's sample stack of a grp scroller.
Tom
MacBook Pro OS Mojave 10.14
MacBook Pro OS Mojave 10.14
-
- VIP Livecode Opensource Backer
- Posts: 9842
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Mobile Scroll vs Web Browser control
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!"?
How many developers get up in the morning and say, "Today I want to build an app with slow rendering!"?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Mobile Scroll vs Web Browser control
< Looking around guiltily > Ok, you got me, I'm the one Richard
-
- VIP Livecode Opensource Backer
- Posts: 7237
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Mobile Scroll vs Web Browser control
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.FourthWorld wrote: ↑Sun Jan 14, 2018 1:23 amWhy 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!"?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- VIP Livecode Opensource Backer
- Posts: 9842
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Mobile Scroll vs Web Browser control
What are those three?
And if we can I identify them, could the engine?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 7237
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Mobile Scroll vs Web Browser control
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.FourthWorld wrote: ↑Sun Jan 14, 2018 9:14 pmWhat are those three?
And if we can I identify them, could the engine?
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
HyperActive Software | http://www.hyperactivesw.com
Re: Mobile Scroll vs Web Browser control
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
set the acceleratedRendering of this stack to true
quailcreek wrote: ↑Sat Jan 13, 2018 7:29 pmHere's sample stack of a grp scroller.
Scrolling Group Test.livecode.zip