scrollbar help

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 help

Post by jalz » Sat Jan 17, 2015 1:21 am

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
Attachments
scrolltest.livecode.zip
(1.18 KiB) Downloaded 176 times
Last edited by jalz on Sat Jan 17, 2015 10:08 am, edited 3 times in total.

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: scrollbar help

Post by Simon » Sat Jan 17, 2015 4:52 am

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
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

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

Re: scrollbar help

Post by jalz » Sat Jan 17, 2015 10:18 am

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

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10102
Joined: Fri Feb 19, 2010 10:17 am

Re: scrollbar help

Post by richmond62 » Sat Jan 17, 2015 6:05 pm

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 168 times

Post Reply