Page 1 of 2
Problem with mobile scroller
Posted: Sun Nov 11, 2018 5:28 pm
by wfr747
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
Re: Problem with mobile scroller
Posted: Sun Nov 11, 2018 11:18 pm
by quailcreek
I think you're better off sending a livecode file in a standard .zip format instead of .rar
Re: Problem with mobile scroller
Posted: Sun Nov 11, 2018 11:24 pm
by Klaus
At your services, Sire!

Re: Problem with mobile scroller
Posted: Sun Nov 11, 2018 11:34 pm
by quailcreek
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?
should be
Re: Problem with mobile scroller
Posted: Mon Nov 12, 2018 6:21 pm
by wfr747
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
Re: Problem with mobile scroller
Posted: Tue Nov 13, 2018 7:51 pm
by jacque
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.
Re: Problem with mobile scroller
Posted: Tue Nov 13, 2018 8:46 pm
by wfr747
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
Re: Problem with mobile scroller
Posted: Tue Nov 13, 2018 8:53 pm
by jacque
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.
Re: Problem with mobile scroller
Posted: Tue Nov 13, 2018 9:13 pm
by wfr747
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
Re: Problem with mobile scroller
Posted: Wed Nov 14, 2018 3:43 pm
by SparkOut
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
Re: Problem with mobile scroller
Posted: Wed Nov 14, 2018 6:43 pm
by jacque
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.
Re: Problem with mobile scroller
Posted: Wed Nov 14, 2018 8:44 pm
by SparkOut

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..."
Re: Problem with mobile scroller
Posted: Wed Nov 14, 2018 10:01 pm
by jacque
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.
Re: Problem with mobile scroller
Posted: Wed Nov 14, 2018 10:56 pm
by bogs
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

Re: Problem with mobile scroller
Posted: Wed Nov 14, 2018 11:08 pm
by SparkOut
I'm not sure warm dog urine tastes any better!
