focus button in one group scroll

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7390
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: focus button in one group scroll

Post by jacque » Wed Feb 18, 2015 8:00 pm

The group must be smaller than its contents or there is nothing to scroll. But more imporant, I don't see any commands in your scrollerDidScroll handler to set the vScroll of the group. You need to add that.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

fko2
Posts: 78
Joined: Sat Feb 07, 2015 12:58 pm

Re: focus button in one group scroll

Post by fko2 » Wed Feb 18, 2015 10:14 pm

Hi Jacque,

I will see for the width of my group...

I have one question...Do i have to control the VScroll in my handler, even if what i want to do is to scroll in horizontal?
Because when i made my handler for the scroll in another card, and was to scroll in vertical, i didn't need to control the HScroll...

Regards.
fko

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7390
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: focus button in one group scroll

Post by jacque » Wed Feb 18, 2015 11:04 pm

You only need to control the directions the app should respond to. That can be only one direction, or both directions.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

fko2
Posts: 78
Joined: Sat Feb 07, 2015 12:58 pm

Re: focus button in one group scroll

Post by fko2 » Thu Feb 19, 2015 10:37 am

Hi Jacque,

Ok, so if i understood well, i can only control the HScroll, because in this card i need only the horizontal scroll...

So, i will change the width of the group and try to see if my code is working!

Regards.
fko

fko2
Posts: 78
Joined: Sat Feb 07, 2015 12:58 pm

Re: focus button in one group scroll

Post by fko2 » Thu Feb 19, 2015 11:17 am

It is me again

So, i changed the width of group...In place of 1759 ( this value was given automatically when i created the group), i made one width of 1024...
the rect of my last element is still: "1549,475,1769,635"
But with my code i posted some days ago, is not working...

So now if i am not wrong, the width of my group is smaller than the content of the elements of the group.
The code it seems correct but anyway is not working the horizontal scroll.

Really i don't know how to advance...

This is my code for the vertical scroll, that is working in another card i have...

Code: Select all

local theScrollerID

on preopenCard
   set the unboundedVScroll of group "MyGroup" to true
end preopenCard

on openCard
   if the environment is "mobile" then
      mobileControlCreate "scroller", "groupScroller1"
      put the result into theScrollerID
      put the topLeft of group "MyGroup" into tRect
      put the right of group "MyGroup" into item 3 of tRect
      put the height of this card into item 4 of tRect
      
      put the formattedWidth of group "MyGroup" into tWidth
      put the formattedHeight of group "MyGroup" into tHeight
      mobileControlSet theScrollerID,"rect", tRect
      mobileControlSet theScrollerID, "contentRect", (0,0,tWidth,tHeight)
      mobileControlSet theScrollerID, "visible", "true"

      iphoneControlSet theScrollerID, "canBounce", "true"
      iphoneControlSet theScrollerID, "scrollingEnabled", "true"
      iphoneControlSet theScrollerID, "canScrollToTop", "true"
      iphoneControlSet theScrollerID, "lockDirection", "true"
      iphoneControlSet theScrollerID, "decelerationRate", "normal"
      iphoneControlSet theScrollerID, "pagingEnabled", "false"
      iphoneControlSet theScrollerID, "indicatorStyle", "black"
      iphoneControlSet theScrollerID, "vIndicator", "true"
      iphoneControlSet theScrollerID, "delayTouches", "true"
      iphoneControlSet theScrollerID, "canCancelTouches", "true"
      iphoneControlSet theScrollerID, "hscroll", 0
      iphoneControlSet theScrollerID, "vscroll", 0
      focus on btn "btnMenu1"
   end if
end openCard


on scrollerDidScroll pHScroll, pVScroll
   set the vScroll of group "MyGroup" to pVScroll
end scrollerDidScroll

on closeCard
   if environment() = "mobile" then
      mobileControlDelete "groupScroller1"
   end if
end closeCard


The width of "MyGroup" 698 and the height is 3702 ( this height was given automatically when i made the 'group selected')
and the rect of the last element in this group is "794,3827,856,3867"

So any correction or modification of this code that is working for one vertical scroll, to make it work for one horizontal scroll???? I feel desperate as i can't see the error i am making...:-(

Regards.
fko

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7390
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: focus button in one group scroll

Post by jacque » Thu Feb 19, 2015 3:59 pm

Code: Select all

on scrollerDidScroll pHScroll, pVScroll
   set the vScroll of group "MyGroup" to pVScroll
end scrollerDidScroll
This handler moves the scroll of the group. It is not handling horizontal scrolling, only vertical.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7390
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: focus button in one group scroll

Post by jacque » Thu Feb 19, 2015 4:52 pm

Also look at the setup in the opencard handler, which sets a vertical scrollbar but no horizontal one.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

fko2
Posts: 78
Joined: Sat Feb 07, 2015 12:58 pm

Re: focus button in one group scroll

Post by fko2 » Thu Feb 19, 2015 5:25 pm

Hi,

I think i didn't express myself well...:-(
this last code is what i am using for one card where i am using one vertical scroll...
So, it is for this that i have nothing in the handlers controlling the horizontal scroll! :-)

So, my question is what should i change in my code, that is working for one vertical scroll, to make it work only for one horizontal scroll in the new i card.

In the code i posted some days ago, i already changed some things as

Code: Select all

on scrollerDidScroll pHScroll, pVScroll
   set the hScroll of group "MyGroup" to pHScroll
   -- I HAD THIS BEFORE    set the vScroll of group "MyGroup" to pVScroll
end scrollerDidScroll
and,

Code: Select all

on preopenCard
   set the unboundedHScroll of group "MyGroup" to true
   -- I HAD THIS BEFORE    set the unboundedVScroll of group "MyGroup" to true
end preopenCard
and the next line in the openCard

Code: Select all

on openCard
      iphoneControlSet theScrollerID, "hIndicator", "true"
      -- I HAD THIS BEFORE    iphoneControlSet theScrollerID, "vIndicator", "true"
end openCard
But even with these changes, is not working the horizontal scrolling...:-(

So, i don't know if i understood you well what are you telling me, or there is somethings more that i am not seeing and / or understanding...:-(

I thought it was quite simple pass from one vertical scroll to one horizontal one, but i am blocked here for some days and i begin to feel impotent...:-(

If you see something more, than what i changed above, in the code that i should change tell me please! :-)

Regards.
fko

fko2
Posts: 78
Joined: Sat Feb 07, 2015 12:58 pm

Re: focus button in one group scroll

Post by fko2 » Fri Feb 20, 2015 11:45 am

Any idea or any little example for one horizontal scrolling??? I feel blocked with this scrolling...

Thanks in advance! :-)

regards.
fko

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4166
Joined: Sun Jan 07, 2007 9:12 pm

Re: focus button in one group scroll

Post by bn » Fri Feb 20, 2015 12:20 pm

Hi fko,

are you sure the formattedWidth of your group is larger than the width of your group?

If not nothing is going to scroll because there is no need to scroll.

could you post the current script you use to do the horizontal scrolling and indicate the width of the group and the formattedWidth of the group?

Kind regards

Bernd

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

Re: focus button in one group scroll

Post by Dixie » Fri Feb 20, 2015 1:00 pm

Attached an example of horizontal scrolling... mmm... old stack, but have just run it again and it is a little 'grumpy' in the simulator but runs fine on an iphone...:-)
Attachments
horzscroll.zip
(90.93 KiB) Downloaded 223 times

fko2
Posts: 78
Joined: Sat Feb 07, 2015 12:58 pm

Re: focus button in one group scroll

Post by fko2 » Fri Feb 20, 2015 3:01 pm

Hi Bernd,

this is my code for the horizontal scrolling:

Code: Select all

local sScrollerIDWeek

on preopenCard
   set the unboundedHScroll of group "grpWeek" to true
end preopenCard


on openCard

   if the environment is "mobile" then
      mobileControlCreate "scroller", "groupScroller3"
      put the result into sScrollerIDWeek
      put the topLeft of group "grpWeek" into tRect
      put the right of group "grpWeek" into item 3 of tRect
      put the height of this card into item 4 of tRect
      
      put the formattedWidth of group "grpWeek" into tWidth
      put the formattedHeight of group "grpWeek" into tHeight
      mobileControlSet sScrollerIDWeek,"rect", tRect
      mobileControlSet sScrollerIDWeek, "contentRect", (0,0,tWidth,tHeight)
      mobileControlSet sScrollerIDWeek, "visible", "true"

      iphoneControlSet sScrollerIDWeek, "canBounce", "true"
      iphoneControlSet sScrollerIDWeek, "scrollingEnabled", "true"
      iphoneControlSet sScrollerIDWeek, "canScrollToTop", "false"
      iphoneControlSet sScrollerIDWeek, "lockDirection", "true"
      iphoneControlSet sScrollerIDWeek, "decelerationRate", "normal"
      iphoneControlSet sScrollerIDWeek, "pagingEnabled", "false"
      iphoneControlSet sScrollerIDWeek, "indicatorStyle", "black"
      iphoneControlSet sScrollerIDWeek, "hIndicator", "true"
      iphoneControlSet sScrollerIDWeek, "delayTouches", "true"
      iphoneControlSet sScrollerIDWeek, "canCancelTouches", "true"
      iphoneControlSet sScrollerIDWeek, "hscroll", 0
      iphoneControlSet sScrollerIDWeek, "vscroll", 0
  
   end if
end openCard

on scrollerDidScroll pHScroll, pVScroll
   set the hScroll of group "grpWeek" to pHScroll
end scrollerDidScroll

the width and the formattedWidth are 1759 in both...So, the problem is here!!! I was turning crazy!!! :-(

It is working now!!! So thanks to Jacque, Bernd and Dixie for your help!!! :-)

I have another conceptual problem, but i will open another topic to ask this, now!!! :-)

Regards.
fko

fko2
Posts: 78
Joined: Sat Feb 07, 2015 12:58 pm

avoid button deformation

Post by fko2 » Fri Feb 20, 2015 3:09 pm

Hi,

The app i am doing, it is running in my iPad where the orientation is landscape, as i really imagined it...
But when it turns to portrait, the buttons are deformed...
I imagine that yes, but i am not able to imagine how should i do this.

In my openStack i have this line:

Code: Select all

  set the fullScreenMode of this stack to "exactFit"
but even when i changed with the other options of the fullScreenMode i have the same problem.
So, how to have the same pretty look of my button in both orientations??? In my case i have one button of 50 x 50 and one image of 50x50 for this button too...

So what should i do to preserve 'round' of this button and image when i change the orientation to portrait?

thanks for your advices / councils or ideas!

Regards.
fko

fko2
Posts: 78
Joined: Sat Feb 07, 2015 12:58 pm

Re: focus button in one group scroll

Post by fko2 » Fri Feb 20, 2015 3:12 pm

Sorry for the moderators!!! :-(
I thought i was writing in one new topic...I Just saw that not, when i pressed submit!

So, i already created the new topic...

If you want to delete it from the reply here it is ok...:-)

Regards,
fko

Post Reply