How to scroll a group with unboundedHScroll?

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

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

How to scroll a group with unboundedHScroll?

Post by JosepM » Sun Jan 23, 2011 9:55 pm

Hi,

How I must scroll a group using the unboundedHScroll and unboundedVScroll? I'm lost... :cry:


Salut,
Josep

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

Re: How to scroll a group with unboundedHScroll?

Post by JosepM » Sun Jan 23, 2011 10:09 pm

:)

Reply myself...

local sScrollerId
local sBottomScrollRect

on preopencard

set the unboundedHScroll of group "gr_1" to true
set the unboundedVScroll of group "gr_1" to true

if the environment is not "mobile" then
exit preOpenCard
end if
iphoneControlCreate "scroller"
put the result into sScrollerId
put the rect of group "gr_1" into tRect
put item 4 of tRect into sBottomScrollRect
iphoneControlSet sScrollerId, "rect", tRect
put the formattedHeight of group "gr_1" into tHeight
put the width of group "gr_1" into tWidth
iphoneControlSet sScrollerId, "contentRect", (0, 0, tWidth, tHeight)

iphoneControlSet sScrollerId, "visible", "true"
iphoneControlSet sScrollerId, "canBounce", true

iphoneControlSet sScrollerId, "declerationRate", fast
iphoneControlSet sScrollerId, "scrollingEnabled", true
iphoneControlSet sScrollerId, "canScrollToTop", true
iphoneControlSet sScrollerId, "delayTouches", true


iphoneControlSet sScrollerId, "hscroll", 0
iphoneControlSet sScrollerId, "vscroll", 0
set the hScroll of group "gr_1" to 0
set the vScroll of group "gr_1" to 0

end preopencard

on scrollerDidScroll pOffsetX, pOffsetY
lock screen
set the hScroll of group "gr_1" to pOffsetX
set the vScroll of group "gr_1" to pOffsetY
unlock screen
end scrollerDidScroll

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

Re: How to scroll a group with unboundedHScroll?

Post by JosepM » Sun Jan 23, 2011 10:34 pm

:? How to scroll a group inside another group? I can't...

UPDATED

Yes, I can :)
My problem was forget to check the "Lock size and position" of the group inside the group.

Also I detected that if the group isn't completely show don't work.
I have a group that appear like a panel with a scroller inside. If the scroller group isn't completely showed it don't scroll.

Someone can confirm this?


Salut,
Josep

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

Re: How to scroll a group with unboundedHScroll?

Post by JosepM » Sun Jan 23, 2011 11:21 pm

Hi again,

Other strange issue...

The scroller group and the scroller bars work although it are hidden... and work "only" into the space that the group occupies when it are showed...

I have a group that I move to a location to show to the user and the touch again, the group move to a location out of the bounds of the screen. Like a panel. Although the group is hidden the scrollbars appear if you drag over the zone that the group occupies when is showed.

A bug?

Salut,
Josep

Post Reply