Problem with mobile scroller

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

wfr747
Posts: 12
Joined: Sat Aug 18, 2018 3:53 pm

Problem with mobile scroller

Post by wfr747 » Sun Nov 11, 2018 5:28 pm

Hi forum,

I have a problem with a mobile scroller. It basically works, but when switching from one stack to another, the following happens:

- open the app
- press "goto stack2" -----> scroller works
- go back to stack1
- press "goto stack3" ------> scroller works
- go back to stack1
- press "goto stack2" again -----> scroller doesn't work anymore

The app is attached. I wonder, why it works only once.

LC version: Windows, LC9 (rc2)
Android: 8.0.0

Thank you
Walter
Attachments
test-scroll.rar
(2 KiB) Downloaded 185 times

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

Re: Problem with mobile scroller

Post by quailcreek » Sun Nov 11, 2018 11:18 pm

I think you're better off sending a livecode file in a standard .zip format instead of .rar
Tom
MacBook Pro OS Mojave 10.14

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Problem with mobile scroller

Post by Klaus » Sun Nov 11, 2018 11:24 pm

At your services, Sire! :D
Attachments
test-scroll.livecode.zip
(2.53 KiB) Downloaded 169 times

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

Re: Problem with mobile scroller

Post by quailcreek » Sun Nov 11, 2018 11:34 pm

There's a typo in both of the cards scripts. ssScrollerID should be sScrollerID
Also I believe your vars should be local and not global. More importantly, why are you using sub-stacks instead of cards on mobile?

Code: Select all

 put the result into ssScrollerID
should be

Code: Select all

 put the result into sScrollerID
Tom
MacBook Pro OS Mojave 10.14

wfr747
Posts: 12
Joined: Sat Aug 18, 2018 3:53 pm

Re: Problem with mobile scroller

Post by wfr747 » Mon Nov 12, 2018 6:21 pm

Thank you for your reply.
I have corrected the typo, I also use local instead of global variables now, but still no luck.
Corrected app is attached (.zip this time).
It still puzzles me that it works 1 time at program start, from the second time on it doesn't.

Tom:
More importantly, why are you using sub-stacks instead of cards on mobile?
I use different stacks in a bigger project, in this example I just wanted to match the same conditions as in the big app, just in case if my problem has something to do with it.

Thank you for your help.
Walter
Attachments
test-scroll.zip
(2.08 KiB) Downloaded 178 times

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

Re: Problem with mobile scroller

Post by jacque » Tue Nov 13, 2018 7:51 pm

I haven't actually looked at the stack, but a common problem is that scrollers aren't deleted when leaving the card. Native controls stay on top of everything, they aren't linked to a single card or control, so it's a good idea to destroy them on closecard and recreate them on preopencard or opencard. Otherwise residual scrollers can interfere with each other.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

wfr747
Posts: 12
Joined: Sat Aug 18, 2018 3:53 pm

Re: Problem with mobile scroller

Post by wfr747 » Tue Nov 13, 2018 8:46 pm

Hi Jacqueline,

Thank you for your reply.
Yes, I do destroy the scroller on closeCard:

Code: Select all

on closeCard
   // Delete the scroller
   if environment() is not "mobile" then exit closeCard
   mobileControlDelete sScrollerID
end closeCard
There must something happen when jumping from one stack to another.

Cheers
Walter

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

Re: Problem with mobile scroller

Post by jacque » Tue Nov 13, 2018 8:53 pm

Okay, so that's not it. Anoather thing may be that the scroller isn't aligned with the LC field. When I create a new scroller I set the scroll of the LC field to zero, create the scroller, and then adjust both scrolls if necessary. If that's not it then I'm out of ideas.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

wfr747
Posts: 12
Joined: Sat Aug 18, 2018 3:53 pm

Re: Problem with mobile scroller

Post by wfr747 » Tue Nov 13, 2018 9:13 pm

Hi Jacqueline,

Could you do me a favour and try the app? I really would be interested if you are able to reproduce the problem, so that I could rule out that it is a failure on my system - at least.

Do the following steps:

- open the app
- press "goto stack2" -----> scroller works
- go back to stack1
- press "goto stack3" ------> scroller works
- go back to stack1
- press "goto stack2" again -----> scroller doesn't work anymore

Thank you
Walter

SparkOut
Posts: 2839
Joined: Sun Sep 23, 2007 4:58 pm

Re: Problem with mobile scroller

Post by SparkOut » Wed Nov 14, 2018 3:43 pm

You know, for jacque, asking to download a stack is about as tasteful as asking her to lick a fire hydrant.

So I checked it out for her (no I didn't lick anything!)

You are moving from one stack to another, and in the closeCard script you are destroying the scroller.

But
Under closeCard, the LC dictionary wrote:A card is closed when the user either goes to another card in the same stack, or closes the stack.
When you are navigating back to stack 1, you are not closing the substacks, so the closeCard handler never gets triggered.
You can workaround in the navigation button script by adding a line

Code: Select all

on mouseUp pMouseButton
   go to card "a1" of stack "stack1"
   close stack "stack2"
end mouseUp
(or close stack "stack3" of course). I am sure there are neater ways than that though, and you might introduce other problems with possible closeStack handlers that fire.

As jwack advised above, in general you should also reset the vScroll of the LiveCode objects (in the preOpenCard handler where you create the new mobile scoller) to match the vScroll of the newly created mobile scroller so they sync:

Code: Select all

   //set the vScroll of the LC objects so they sync
   set the vScroll of group "scrollArea" to 0
   set the vScroll of field "Field" of group "scrollArea" to 0

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

Re: Problem with mobile scroller

Post by jacque » Wed Nov 14, 2018 6:43 pm

Thanks for testing, SparkOut. It wasn't distasteful to ask me to test (I do have a fire hydrant on our corner, after all) but it would take some time to download and set up a test and I need to find a gap in my schedule to do that, so it would take longer. I usually read the forums on my tablet over coffee in the morning where I'm not near the computer.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

SparkOut
Posts: 2839
Joined: Sun Sep 23, 2007 4:58 pm

Re: Problem with mobile scroller

Post by SparkOut » Wed Nov 14, 2018 8:44 pm

:oops: I shouldn't have suggested that, I know you don't get to download things normally (I too almost always read the forum on my phone). I was going for a bit of humour. Rereading I realise that I imply you mistrust the request and don't want to help. Nothing could be further from the truth and I apologise.
I could have said "getting jacque in a situation where she can download and test it is about as likely as a situation where she would lick a fire hydrant". But really I should not have gone for anything like that, it still implies some sort of faling or reluctance on your part. I'd have been better just to have said "I'll save jacque the trouble..."

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

Re: Problem with mobile scroller

Post by jacque » Wed Nov 14, 2018 10:01 pm

Oh, not at all! I actually laughed, it was funny. And I really DO have a fire hydrant outside. :)

Nothing to apologize for at all. I appreciate your help, and if anything, my own response wasn't clear enough. I should have added smileys.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

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

Re: Problem with mobile scroller

Post by bogs » Wed Nov 14, 2018 10:56 pm

jacque wrote:
Wed Nov 14, 2018 10:01 pm
Oh, not at all! I actually laughed, it was funny. And I really DO have a fire hydrant outside. :)
Well, just make sure you don't lick it in the winter time :shock:
Image

SparkOut
Posts: 2839
Joined: Sun Sep 23, 2007 4:58 pm

Re: Problem with mobile scroller

Post by SparkOut » Wed Nov 14, 2018 11:08 pm

I'm not sure warm dog urine tastes any better! :shock:

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”