more than one iOS scroller on a card

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
sims
Posts: 43
Joined: Wed Apr 12, 2006 5:36 pm

more than one iOS scroller on a card

Post by sims » Thu Jul 24, 2014 12:21 pm

Is it possible to have more than one iOS scroller on a card?

If so, how does one do this?

Any examples available?

sims

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: more than one iOS scroller on a card

Post by Simon » Thu Jul 24, 2014 2:47 pm

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
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

sims
Posts: 43
Joined: Wed Apr 12, 2006 5:36 pm

Re: more than one iOS scroller on a card

Post by sims » Thu Jul 24, 2014 5:47 pm

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

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

Re: more than one iOS scroller on a card

Post by Klaus » Thu Jul 24, 2014 5:54 pm

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

sims
Posts: 43
Joined: Wed Apr 12, 2006 5:36 pm

Re: more than one iOS scroller on a card

Post by sims » Thu Jul 24, 2014 6:07 pm

Hey Klaus! Long time no see.

Sent you a PM.

sims

GSA_DC
Posts: 35
Joined: Thu Nov 27, 2014 2:07 pm

Re: more than one iOS scroller on a card

Post by GSA_DC » Wed Jan 14, 2015 3:19 pm

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.

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4166
Joined: Sun Jan 07, 2007 9:12 pm

Re: more than one iOS scroller on a card

Post by bn » Wed Jan 14, 2015 4:44 pm

Hi Paul,

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

Kind regards
Bernd

GSA_DC
Posts: 35
Joined: Thu Nov 27, 2014 2:07 pm

Re: more than one iOS scroller on a card

Post by GSA_DC » Thu Jan 29, 2015 11:40 am

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.

Post Reply