Native Scroller for images - no horizontal scrolling

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
dmeier
Posts: 15
Joined: Mon May 25, 2015 10:52 am

Native Scroller for images - no horizontal scrolling

Post by dmeier » Fri Aug 14, 2015 5:43 pm

Hi

I tried to code a native scroller for images. I followed the instruction on http://lessons.runrev.com/s/lessons/m/4 ... ll-a-field
but my scroller is only scrolling vertically not horizontally.

What I did

a) put 3 pics on a card
b) locked their size and position
c) grouped the pics
d) created a scroller with the rect of the group
e) resized the group and locked the size and position

I dont get it working :?
I attached my stack which is configured to run with iOS.

Thanks for help
David
Attachments
mScroller.livecode.zip
(2.05 KiB) Downloaded 264 times

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

Re: Native Scroller for images - no horizontal scrolling

Post by Simon » Sun Aug 16, 2015 1:05 am

Hi David,
Not to be an ass or anything but I think if you just look at this code you can figure it out?

Code: Select all

on scrollerDidScroll hOffset, vOffset
   // When the user scrolls move the displayed content
   set the vScroll of group "scrollArea" to vOffset
end scrollerDidScroll
What do you think hOffset is?

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

dmeier
Posts: 15
Joined: Mon May 25, 2015 10:52 am

Re: Native Scroller for images - no horizontal scrolling

Post by dmeier » Sun Aug 16, 2015 7:53 am

Hi Simon

I just didn't see the wood for the trees. I was so sure I made an error with the ContentRect that I oversaw the missing line for "hScroll" in the "scrollerDidScroll" handler.

Thank you very much for your help

Regards David

For clearness that's what I have now:

To scroll vertically and horizontally I use now the following code, which works perfectly

on scrollerDidScroll hOffset, vOffset
// When the user scrolls move the displayed content
set the vScroll of group "scrollArea" to vOffset
set the hScroll of group "scrollArea" to hOffset
end scrollerDidScroll

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

Re: Native Scroller for images - no horizontal scrolling

Post by Simon » Sun Aug 16, 2015 8:30 am

Hi David,
Glad you got it!

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Post Reply