sluggish scroller [Solved]

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Jellobus
Posts: 317
Joined: Tue Dec 10, 2013 2:53 pm

sluggish scroller [Solved]

Post by Jellobus » Sun Dec 20, 2015 11:07 am

Hello

I always noticed when a native scroller is created and start to scroll, the first scrolling is not smooth and sluggish until the all contents (images, texts) are revealed. I tried

Code: Select all

on preOpenCard
  prepare image file "FILENAME of all content images"
end preOpenCard
but there was no performance improvement.. Is anyone know how to increase the performance of the scroller?
Last edited by Jellobus on Mon Dec 21, 2015 11:03 am, edited 1 time in total.

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: sluggish scroller

Post by Dixie » Sun Dec 20, 2015 12:33 pm

On iOS or Android... ?
Would you like to post your code ?

Jellobus
Posts: 317
Joined: Tue Dec 10, 2013 2:53 pm

Re: sluggish scroller

Post by Jellobus » Sun Dec 20, 2015 4:10 pm

Hi Dixie,
The issue found on Android.
The stack was originally built with LC 6.5.2. It was working fine back then but I found the scroller sluggish once the stack was deployed with the latest LC 6.7.8 (rc4).

the code is here.

Code: Select all

on preOpenStack
   set the acceleratedRendering of this stack to true
end preOpenStack

on setScroller
   if the environment is "mobile" then
      put the rect of group "Scroll" of this card into tScrollerRect
      put 0,0,400,2249 into tContentRect 
      mobileControlCreate "scroller", "GroupScroll"
      put the result into sScrollerID
      mobileControlSet "GroupScroll", "rect", tScrollerRect
      mobileControlSet "GroupScroll", "contentRect", tContentRect
      mobileControlSet "GroupScroll", "visible", true
      mobileControlSet "GroupScroll", "vIndicator", true
      mobileControlSet "GroupScroll", "vscroll", 0
   end if
end setScroller

on scrollerDidScroll hOffset, vOffset
   lock screen
   set the vScroll of group "Scroll" to vOffset
   unlock screen
end scrollerDidScroll

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: sluggish scroller

Post by Dixie » Sun Dec 20, 2015 5:49 pm

Hi...

Your code looks fine to me... but you don't need to use 'lock screen' in your 'scrollerDidScroll' handler... taking out the 'lock screen' statements, does that make a difference ?, I think it should as this handler scrolls continually whilst scrolling...

dixie

Jellobus
Posts: 317
Joined: Tue Dec 10, 2013 2:53 pm

Re: sluggish scroller

Post by Jellobus » Mon Dec 21, 2015 2:31 am

Hi Dixie,

I tried without lock screen but the result was same. The stack was originally built with LC 6.5.2 so I am thinking rebuild a complete replica of the current stack with the latest LC 6 or 7 version. Complete rebuilding can be just waste of time but I don't see many other options. :roll: I will let you know if there is any performance improvement. Thanks.

Louis

Jellobus
Posts: 317
Joined: Tue Dec 10, 2013 2:53 pm

Re: sluggish scroller

Post by Jellobus » Mon Dec 21, 2015 11:02 am

Hi Dixie,

The issue has been fixed! :D I just set the resizeQuality of images in the scroller to "Good" from "best". Scrolling is very smooth and the image quality in "good" is not bad. Thanks for your advice.

Cheers,

Louis

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: sluggish scroller [Solved]

Post by Klaus » Mon Dec 21, 2015 12:35 pm

...
set the resizeQuality of img 1 to "not bad"
...
I like that! :D

Post Reply