Trying to figure this out

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3999
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Trying to figure this out

Post by bn » Thu Mar 17, 2011 4:41 pm

Hi Padley,

I modified the first stack I posted so that images in the horizontal scroller scroll into view after scrolling. That way you have one image centered at a time.
Should be generic enough for other/more pictures.


Kind regards
Bernd

Edit: I tested it on my iPhone G3 and the snapping to the image after scrolling was a little too slow.
To speed that up you can increase the stepsize in the repeat loop to 10 in the card script in the "findNearest" handler

Code: Select all

      repeat with i = tCurrentLoc  to tClose step 10 -- change stepsize
         set the hScroll of group "picGroup" to i
         wait 5 milliseconds with messages
      end repeat
   else
      repeat with i =  tCurrentLoc down to tClose step - 10 -- change stepsize
         set the hScroll of group "picGroup" to i
         wait 5 milliseconds with messages
      end repeat
Attachments
horzPicScrollToCenterOfPic_0.1.livecode.zip
(132.3 KiB) Downloaded 223 times

padley123
Posts: 5
Joined: Wed Feb 09, 2011 5:20 pm

Re: Trying to figure this out

Post by padley123 » Fri Mar 18, 2011 12:21 pm

Wow thank you very much BN it makes much more sense now.

JosepM
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 344
Joined: Tue Jul 20, 2010 12:40 pm

Re: Trying to figure this out

Post by JosepM » Thu Apr 07, 2011 7:27 pm

Hi,

I just download and play with the examples horzPicScroll and horzPicShow into the iPad.

I copied two times the horzPicShow group to test it but only the one that have the layer = 1 work.
Why?

Salut,
Josep

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3999
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Trying to figure this out

Post by bn » Thu Apr 07, 2011 8:36 pm

Hi Josep,
I copied two times the horzPicShow group to test it but only the one that have the layer = 1 work.
Why?
because the logic is all in the card script and on openCard triggers a handler "createUIViewScroll". This handler initializes ONE (1) instance of a scrolling area.

If you place 2 horzPicShow groups on the same card the opencard will grab the first "picGroup" group available and that is the one with the lowest layer.

Kind regards

Bernd

JosepM
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 344
Joined: Tue Jul 20, 2010 12:40 pm

Re: Trying to figure this out

Post by JosepM » Thu Apr 07, 2011 9:39 pm

Hi,

horzPicScroll have the logic into the card, yes, but I testing the horzPicShow and in the card haven't any code, all the code is inside the group "picGroup".
In my case I have two groups, "picGroup" and "picGroup2".

Changing the layer value from one to other, produce that run one or other...

Salut,
Josep

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3999
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Trying to figure this out

Post by bn » Thu Apr 07, 2011 10:02 pm

Hi Josep,

how do you initialize the scrolling area in the groups ?

I suggest you change all references to picGroup and change them to picGroup2 in the second group. Of Course you would have to rename the group accordingly. (Not tested since I don't know exactly what you are doing)

Kind regards

Bernd

Post Reply

Return to “iOS Deployment”