PagingEnabled Horizontally
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
PagingEnabled Horizontally
Is there a way to only have the iPhoneControl "PagingEnabled" to work horizontally? I have a datagrid in a native scrolling group, and I'd like to have a couple of columns off to the side, accessible by swiping. I'd like to be able to swipe up and down just normally, but use the paging feature when I swiped horizontally.
			
			
									
									
						Re: PagingEnabled Horizontally
I think you are going to have to use 2 cards with duplicate datagrids, the first card has the left side of the datagrid showing and card 2 the dg should have it's location set so that it only shows the columns you want.
Simon
			
			
									
									Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
						Re: PagingEnabled Horizontally
Hmm... Alright, thanks for the suggestion. I'll see if I can get it to work.
			
			
									
									
						Re: PagingEnabled Horizontally
Ahh shoot!
I just realised it gets a bit more complicated. If you are halfway down the page and swipe to the next card you have to scroll down to where you were. This can be coded for but it's a bit more effort.
Simon
			
			
									
									I just realised it gets a bit more complicated. If you are halfway down the page and swipe to the next card you have to scroll down to where you were. This can be coded for but it's a bit more effort.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
						Re: PagingEnabled Horizontally
Thats always been something I've tried to figure out to no avail.... How do you save your scroll location and pick it up again?
			
			
									
									
						Re: PagingEnabled Horizontally
Check out vScroll in the dictionary
You should set the vSroll of the field/group in card 2 on preOpen
Simon
			
			
									
									You should set the vSroll of the field/group in card 2 on preOpen
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
						Re: PagingEnabled Horizontally
Aha! Got everything working properly, thank you for the help!
			
			
									
									
						Re: PagingEnabled Horizontally
Glad I could help!  
 
Simon
			
			
									
									 
 Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
						Re: PagingEnabled Horizontally
I guess I'm still having a minor issue. Sorry for taking the original question completely off topic. But since we were talking about resuming the location of the scroller, I've got a little problem. The scroller resumes to its correct location, after a split second of it being in its start location. Here's the code, if you could look at it that would be great.
			
			
									
									
						Code: Select all
local sScrollerID
local sScroll
on preOpenCard
   send createscroller to me
end preOpenCard
on createscroller
   lock screen
   if the environment is not "mobile" then
      exit createscroller
      unlock screen
   end if
   set the vScroll of group "ScrollerGroup" to 0   
   iphoneControlCreate "scroller"
   put the result into sScrollerId
   set the unboundedVScroll of group "Scrollergroup" to true 
   iphoneControlSet sScrollerId, "vScroll", sScroll
   iphoneControlSet sScrollerId, "visible", "true"
   iphoneControlSet sScrollerId, "canBounce", "true"
   iphoneControlSet sScrollerId, "ScrollingEnabled", "true"
   iphoneControlSet sScrollerId, "pagingEnabled", "false"
   iphoneControlSet sScrollerId, "canScrollToTop", "true"
   iphoneControlSet sScrollerId, "vIndicator", "false"
   iphoneControlSet sScrollerId, "contentRect",  (0,0,320,800)
   iphoneControlSet sScrollerId, "rect", (the rect of group "ScrollerGroup")
   unlock screen
end createscroller
on scrollerDidScroll OffsetX, OffsetY
[b]   set the vScroll of group "ScrollerGroup" to OffsetY
[/b]end scrollerDidScroll
on closecard 
   if the environment is not "mobile" then
      exit closecard
   end if
[b]   put the vScroll of group "ScrollerGroup" into sScroll
[/b]   iphoneControlDelete sScrollerId
end closecard
Re: PagingEnabled Horizontally
To get you started try removing from the closeCard
iphoneControlDelete sScrollerId
and adding to the top
global sScrollerId,sScrollerIdcd2
(note that you don't have to have the send command for a handler)
Do that for both cards with sScrollerIdcd2 on the second card with all the create related to that.
Put the iphoneControlDelete sScrollerId (and sScrollerIdcd2) in a on closeStack handler.
I "think" that should speed up moving from card to card but the 1st time you use it there will be a delay. I don't see a way to create a control on a different card.
Also try setting the vScroll of cd 2 at the same time as 1
remove any preOpenCard vScroll settings.
Ok that is a crazy start, there is probably a lockscreen method on preOpenStack to create both scrollers.
This is all untested.
Simon
			
			
									
									iphoneControlDelete sScrollerId
and adding to the top
global sScrollerId,sScrollerIdcd2
Code: Select all
on preOpenCard
if sScrollerId = empty then
   createscroller
end if
end preOpenCardDo that for both cards with sScrollerIdcd2 on the second card with all the create related to that.
Put the iphoneControlDelete sScrollerId (and sScrollerIdcd2) in a on closeStack handler.
I "think" that should speed up moving from card to card but the 1st time you use it there will be a delay. I don't see a way to create a control on a different card.
Also try setting the vScroll of cd 2 at the same time as 1
Code: Select all
on scrollerDidScroll OffsetX, OffsetY
  set the vScroll of group "ScrollerGroup" to OffsetY
  if sScrollerIdcd2 <> empty then
     set the vScroll of group "ScrollerGroupcd2" of cd2 to OffsetY
   end if
end scrollerDidScrollOk that is a crazy start, there is probably a lockscreen method on preOpenStack to create both scrollers.
This is all untested.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
						Re: PagingEnabled Horizontally
Thanks for all the help Simon! I think I have decided to go a slightly different route with regards to the two datagrids, but your advice has been helpful for other aspects of my app!
Thanks again!
Jarren
			
			
									
									
						Thanks again!
Jarren

