Mobile- button scroll

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
saviour
Posts: 26
Joined: Wed Feb 05, 2014 5:11 am

Mobile- button scroll

Post by saviour » Fri Feb 21, 2014 12:43 pm

Hi there,

I want to have scrolling buttons over a card for a mobile application. With referring to Native Scroller lesson, I created a group of buttons "button".
Now, what variation of below script needs to be put on the parent card so I can have scrolling button??

local sScrollerID

on preOpenCard
local tScrollerRect, tContentRect

// Only create a scroller on a mobile device
if environment() is not "mobile" then exit preOpenCard

// Set the area of the scroller
put the rect of group "button" into tScrollerRect

// Set the are of the content to be scrolled
put the left of field "lorem",the top of field "lorem",the right of field "lorem",the formattedHeight of field "lorem" into tContentRect

// Create the scroller control
mobileControlCreate "scroller", "loremScroll"
put the result into sScrollerID

// Set the properties of the scroller
mobileControlSet "loremScroll", "rect", tScrollerRect
mobileControlSet "loremScroll", "contentRect", tContentRect
mobileControlSet "loremScroll", "visible", true
mobileControlSet "loremScroll", "scrollingEnabled", true
mobileControlSet "loremScroll", "vIndicator", true
mobileControlSet "loremScroll", "vscroll", 0
end preOpenCard

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

Please help.
Last edited by saviour on Thu Nov 12, 2015 2:33 am, edited 1 time in total.

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Mobile- button scroll

Post by Dixie » Fri Feb 21, 2014 3:53 pm

Hi..

Have a look at the attached stack... it allows you to create buttons in a group 'setgroup' that will scroll. All the handlers are in the stack script.
Hope it helps...
Attachments
scrollButtons.livecode.zip
(2.66 KiB) Downloaded 177 times

saviour
Posts: 26
Joined: Wed Feb 05, 2014 5:11 am

Re: Mobile- button scroll

Post by saviour » Sat Feb 22, 2014 6:20 pm

Thanks... I will try it out!!!

Post Reply