Page 1 of 1

scrollbar help

Posted: Sat Jan 17, 2015 1:21 am
by jalz
Hi Guys,
Ive enclosed a stack which has 3 objects in it. There are two objects on display, if you click a button, a third object appears where the second object was and moves the second object further down the card. Infact it moves it down the card significantly (and off my 13" screen), so I need a vertical scrollbar on the card. I've tested grouping all three object and applying the scrollbar to the group which works relatively well, but my real layout is far more complicated than this and has over 30 objects (some which are grouped) which are constantly changing some of which are grouped and I'm concerned that I may end up editing groups within groups and I'd like to keep it as simple as possible.

I've never figured out how these scrollbars from the tools palette work. Is there anyone out there that can modify my simple stack by adding a native scroll bar from the tools pallet and making it active when all three rectangles from my stack are on display?

Thanks as always

Jalz

Re: scrollbar help

Posted: Sat Jan 17, 2015 4:52 am
by Simon
Hi Jalz,
Here is the start of it, put it into the scrollbar script

Code: Select all

local go4It
on mouseDown
   put true into go4It
   countIt
end mouseDown

command countIt
   if go4It then
      put the thumbposition of me
      send countIt to me in 10 millisec
      end if
end countIt

on mouseUp
     put false into go4It
end mouseUp
Now from that you can "move" or "set loc" of your blocks but seems to me that that would be harder then grouping because as the number of blocks increases the scrollbar has to reset it's value so that all the way down = 100% scroll distance always.

Make sense?

Simon

Re: scrollbar help

Posted: Sat Jan 17, 2015 10:18 am
by jalz
Hi Simon,
Thanks for the reply and the code, I've got the vscrollbar on groups to work now. Adding your code to the scroll bar and noticed in the message box the thumb position its returning. Its interesting to note regardless of the size of the scrollbar, the max position is always 57343. Im guessing I can use the setloc like you have suggested, but then again I will have to end up grouping all my objects before hand to shift them down - I can't just move then entire card.

I think I may just stick to the grouping them - but I'll do some reading on these things as they intrigue me (as do progress bars but not had to use one yet)

Thanks
Jalz

Re: scrollbar help

Posted: Sat Jan 17, 2015 6:05 pm
by richmond62
I had a look at the code in your button:

on mouseUp
if (visible of graphic "Rectangle2" is false) then
set the top of graphic "Rectangle3" to 480
set the visible of graphic "Rectangle2" to true
else
set the top of graphic "Rectangle3" to 310
set the visible of graphic "Rectangle2" to false
end if

so, all it does is shunt the top of "Rectangle3" up and down from 310 to 480 and back again.

What I don't quite understand are these things:

1. Why do you have such a small monitor?

2. Surely all you need to do is reduce the sizes of everything considerably and the numbers for shunting.

Here is what I mean:
grouped_scroll_mod.livecode.zip
(803 Bytes) Downloaded 169 times