Page 1 of 1

scrollbar and scaling

Posted: Sat Jun 06, 2015 1:31 am
by jalz
Hi Guys,

I have a scrollbar attached to a grouped object.Within the scroll bar, there is an graphic called rectangle. When I use the vertical scrollbar to to scroll down, the rectangle moves up which it should as the rectangle isn't as tall as some of the other components on the page. What I would like to do is ensure the rectangle is flush at the top and flush at the bottom of the card when a user scrolls up and down.

Anyone know how i can achieve this?

tanks as always

Jalz

Re: scrollbar and scaling

Posted: Sat Jun 06, 2015 2:00 pm
by jalz
Ah I think I can do this by finding the bottom of the object that is the furthest down on a page.
Does anyone know the relevant command I can use to find the furthest object on a card or am I going to have to loop through all the objects to find the one thats the furthest down?

Thanks
Jalz

Re: scrollbar and scaling

Posted: Sat Jun 06, 2015 3:05 pm
by SparkOut
I confess I'm not absolutely sure what you are doing in your measurements, but maybe the formatteHeight of group "myGroup" is what you need.

Re: scrollbar and scaling

Posted: Sat Jun 06, 2015 5:39 pm
by jalz
Hi SparkOut,

I've managed to solve my problem by just hardcoding the position of the last object. Its just easier, especially as I figure the object shouldn't move on the card and I already know whats the last object.

I do have another question relating to scrollbar and this title fits this problem as well. I've got the code below which applies a scrollbar to the group depending on the size of the card and formatted content (using resizeStack handler). It works quite well, apart from if I have some content which I have scrolled down and I call the script via button, the content jumps/resets back to the top. Hope that makes sense? Is there a way where I can keep the content position the same if I run that script via a button?

Code: Select all

command applyScrollBars
   if the formattedHeight of group "grp_scrollbar" > the height of group "grp_scrollbar" then
      set the vScrollbar of group "grp_scrollbar" to true
   else
      set the vScrollbar of group "grp_scrollbar" to false
   end if
   
   if the formattedWidth of group "grp_scrollbar" > the width of group "grp_scrollbar" then
      set the hScrollbar of group "grp_scrollbar" to true
   else
      set the hScrollbar of group "grp_scrollbar" to false
   end if
end applyScrollBars

Re: scrollbar and scaling

Posted: Sat Jun 06, 2015 5:46 pm
by Klaus
Hi jalz,

if you want to save some typing:

Code: Select all

command applyScrollBars
   set the vScrollbar of group "grp_scrollbar" to (the formattedHeight of group "grp_scrollbar" > the height of group "grp_scrollbar")  
   set the hScrollbar of group "grp_scrollbar" to (the formattedWidth of group "grp_scrollbar" > the width of group "grp_scrollbar")
end applyScrollBars
:D


Best

Klaus

Re: scrollbar and scaling

Posted: Sun Jun 07, 2015 5:25 pm
by jacque
Store the original scroll in a variable, lock the screen, apply the scrollbar, reset the scroll to the original, and unlock the screen.

Re: scrollbar and scaling

Posted: Mon Jun 08, 2015 11:33 pm
by jalz
just wanted to say thank you to both of you. Got it working now on my page "fairly" reliably. Some more testing