scrollbar and scaling

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
jalz
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 340
Joined: Fri Sep 12, 2008 11:04 pm

scrollbar and scaling

Post by jalz » Sat Jun 06, 2015 1:31 am

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

jalz
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 340
Joined: Fri Sep 12, 2008 11:04 pm

Re: scrollbar and scaling

Post by jalz » Sat Jun 06, 2015 2:00 pm

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

SparkOut
Posts: 2961
Joined: Sun Sep 23, 2007 4:58 pm

Re: scrollbar and scaling

Post by SparkOut » Sat Jun 06, 2015 3:05 pm

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.

jalz
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 340
Joined: Fri Sep 12, 2008 11:04 pm

Re: scrollbar and scaling

Post by jalz » Sat Jun 06, 2015 5:39 pm

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

Klaus
Posts: 14267
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: scrollbar and scaling

Post by Klaus » Sat Jun 06, 2015 5:46 pm

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

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

Re: scrollbar and scaling

Post by jacque » Sun Jun 07, 2015 5:25 pm

Store the original scroll in a variable, lock the screen, apply the scrollbar, reset the scroll to the original, and unlock the screen.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

jalz
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 340
Joined: Fri Sep 12, 2008 11:04 pm

Re: scrollbar and scaling

Post by jalz » Mon Jun 08, 2015 11:33 pm

just wanted to say thank you to both of you. Got it working now on my page "fairly" reliably. Some more testing

Post Reply