Getting scrollbars to work in a specific way

Deploying to Windows? Utilizing VB Script execution? This is the place to ask Windows-specific questions.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Mills
Posts: 8
Joined: Wed Aug 07, 2013 11:42 am
Location: Cape Town, South Africa

Getting scrollbars to work in a specific way

Post by Mills » Mon Mar 10, 2014 2:43 pm

Good day All

I have been trying to get my head around this small little problem with no luck.

I would really appreciate it if someone can help me with this.

I have added a sample stack to explain the problem I'm experiencing.

In the stack I have a group with fields and graphics, there is also buttons in the
stack, the buttons are not part of the group. On the properties of the group
I have ticked the boxes for Horizontal and Vertical scrolling.

The horizontal scroller is working perfectly, as the field with graphics and
the fields on top (that is numbered) scrolls together. The buttons on the left
are not scrolling with the group and that is correct for the solution I need.

When you use the Vertical scroller everything works as expected. The
field with graphics and the fields on the top scrolls vertically as per normal.
However this is where I only need the the field with graphics and the buttons
on the left to scroll together vertically and the fields that is numbered on
top needs to remain where it is without scrolling vertically.

I hope this makes sense....? What I'm trying to achieve...

I have tried to create another group with the buttons and the field with
graphics together, but I cant get the exact result I need.

Is there any other way of adding a scrollbar that will give me the effect I need?

I need the scrollbars to be as showed in the example, grouping it differently puts
the vertical scrollbar at the end of the field and that defeats the purpose
of what I need the solution for.

I sure there is a simple solution that I have overlooked....

Kind regards
Mills
Attachments
SampleScroller.zip
My Scrolling sample
(776 Bytes) Downloaded 271 times

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

Re: Getting scrollbars to work in a specific way

Post by Simon » Tue Mar 11, 2014 12:11 am

Hi Mills,
If I understand you correctly, something like this is what you want

Code: Select all

on scrollbarDrag
   put the loc of btn 1 into tLoc
   set the loc of btn 1 to item 1 of the loc of grc "red", item 2 of tLoc
end scrollbarDrag
It's not perfect but you can work out the exact numbers.
grc red is the red rectangle in your stack (could be anything in the group). btn 1 is the top button.
You can see that only left/right in the location of the button is changing, item 2 always stays the same.

Make sense?

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

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

Re: Getting scrollbars to work in a specific way

Post by Simon » Tue Mar 11, 2014 12:11 am

Hi Mills,
If I understand you correctly, something like this is what you want

Code: Select all

on scrollbarDrag
   put the loc of btn 1 into tLoc
   set the loc of btn 1 to item 1 of the loc of grc "red", item 2 of tLoc
end scrollbarDrag
It's not perfect but you can work out the exact numbers.
grc red is the red rectangle in your stack (could be anything in the group). btn 1 is the top button.
You can see that only left/right in the location of the button is changing, item 2 always stays the same.

Make sense?

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

PBH
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 129
Joined: Sun Feb 20, 2011 4:26 pm
Location: Vancouver Island, BC, Canada. ex.UK
Contact:

Re: Getting scrollbars to work in a specific way

Post by PBH » Tue Mar 11, 2014 1:40 am

Hi Mills,

If I understood you correctly the attached stack should work OK.

Basically I separated the controls into three groups, one main group for the grid, one group for the buttons and one group for the fields. I added graphic boxes to the button and field groups to make their size match the main group (these are coloured grey in the sample), then I scripted the main group to make the two other groups follow in the direction of the grid as required. i.e. The button group only scrolls vertically and the field group only scrolls horizontally.

Just turn off the 'opaque' property of the grey graphics to hide them.

Hopefully that will all make sense when you look at the sample. :D

Paul
SampleScroller.zip
(1.22 KiB) Downloaded 266 times

Mills
Posts: 8
Joined: Wed Aug 07, 2013 11:42 am
Location: Cape Town, South Africa

Re: Getting scrollbars to work in a specific way

Post by Mills » Tue Mar 11, 2014 8:20 am

Hi Simon & Paul

Thank you for the prompt response!

The solutions you guys gave are exactly what I needed. I was so caught up in the problem that I overlooked the simplest solutions.

Thanks once again for the help, really appreciate it! You saved me from growing a few extra grey hairs... 8)

Regards
Mills

Post Reply

Return to “Windows”