Page 1 of 1

more than one iOS scroller on a card

Posted: Thu Jul 24, 2014 12:21 pm
by sims
Is it possible to have more than one iOS scroller on a card?

If so, how does one do this?

Any examples available?

sims

Re: more than one iOS scroller on a card

Posted: Thu Jul 24, 2014 2:47 pm
by Simon
Hi sims,
Each time you create a native scroller you set an ID of that scroller.
mobileControlCreate "scroller", "loremScroll"
put the result into sScrollerID
When you have multiple scrollers just keep changing the sScrollerID and reference the one you want by it.

Simon

Re: more than one iOS scroller on a card

Posted: Thu Jul 24, 2014 5:47 pm
by sims
Thank you for the reply Simon.

For example i want three scrollers on the same card.
Please pardon my ignorance with this but in the example they give the scroller is created in a preOpenCard handler.
That scroller has this unique ID.

Are you suggesting that I have three version of that code in the preOpenCard handler, each with different names of their group and field that contains the text - save the ID of each, perhaps as a userProp. Then call up that ID as needed?

Or are you suggesting that I create a scroller on the card each time i click on a group that represents a scroller - outside of the preOpenCard handler?

Am feeling fairly dense on this... :-P

sims

Re: more than one iOS scroller on a card

Posted: Thu Jul 24, 2014 5:54 pm
by Klaus
Hi sims,

how are you, you old son-of-a-gun? :D

Yes, create three scoller objects on preopencard and store their IDs in LOCAL variables.
That's what I do and I put all "mobile" hanlders also into the card script, so locals are the way to go (for me)!


Best

Klaus

Re: more than one iOS scroller on a card

Posted: Thu Jul 24, 2014 6:07 pm
by sims
Hey Klaus! Long time no see.

Sent you a PM.

sims

Re: more than one iOS scroller on a card

Posted: Wed Jan 14, 2015 3:19 pm
by GSA_DC
Hello there.

Following this thread up...

I appreciate that I can create many native mobile controls by using doing something like:

Code: Select all

local mobCntrlA, mobCntrlB

on openCard
   mobileControlCreate "scroller"
   put the result into mobCntrlA
   mobileControlCreate "scroller"
   put the result into mobCntrlB
end openCard
However...

if using a scroller for example, using the handler:

Code: Select all

on scrollerDidScroll pOffsetX, pOffsetY
   lock screen
   set the hScroll of group thisGroup to pOffsetX
   set the vScroll of group thisGroup to pOffsetY
   unlock screen
end scrollerDidScroll
... how do you look out for each scroller control? Is there a 3rd parameter I don't know about which identifies the control?

Go on - elucidate :)

Kind regards, Paul.

Re: more than one iOS scroller on a card

Posted: Wed Jan 14, 2015 4:44 pm
by bn
Hi Paul,

have a look at mobileControlTarget in the dictionary.
It tells you which control has originated a certain message.

Kind regards
Bernd

Re: more than one iOS scroller on a card

Posted: Thu Jan 29, 2015 11:40 am
by GSA_DC
Ah - right.

So I can just use a switch statement in eg. scrollerDidScroll to determine what controller is scrolling. I get it. Thanks.

Kind regards, Paul.