Example of scrolling group?

Douglas dougtechie at tiscali.co.uk
Fri Jun 4 19:12:58 EDT 2010


Thanks Bernd,
That certainly helped me out, and also shows why I was getting grey 
rectangles instead of scroll bars.
I copied your example and made a test stack like yours.

Jeff M. -
Here's some stuff I figured out:-
If the window size is larger than the group and the hScrollbar or 
vScrollbar is true then the scroll bars turn into these grey rectangles.
You can set the maximum width and height of the card to the original 
group size - that will leave the full scroll bars at max size.
You can set the hScrollbar / vScrollbar  to false if the window is over 
the group size and the scrollbars will vanish when the window is changed.
Or just don't allow the user to change the window size at all!

The scroll bars are included in the group, so the group size is original 
group size PLUS the scroll bar width (16 by default).
(Otherwise the scroll bars obscure the group fields etc at the edges.)

When you are changing width or height of card within a card script, you 
need to keep track of the scrollbars with a resizeStack routine as below.
Bernd has introduced  a little interest below by putting in the 30 pixel 
offset from the top of the card.
I found that a little confusing when messing about in the IDE and 
changing window sizes etc.

I should be able to get on with it now, thanks again, Bernd

Douglas

On 04/06/2010 11:22, BNig wrote:
> David,
> I made a little test stack with four fields on the corners of the card.
> These fields are grouped. Into the script of the card I put this handler:
> ----------------
> on resizeStack
>     set the width of group 1 to the width of  card 1
>     set the height of group 1 to the height of  card 1 -30  -- adjust
>     set the topleft of group 1 to 0,30 -- adjust
>     if the width of card 1>  780 then -- adjust
>        set the hScrollbar of group 1 to false
>     else
>        set the hScrollbar of group 1 to true
>     end if
>     if the height of card 1>  520 then -- adjust
>        set the vScrollbar of group 1 to false
>     else
>        set the vScrollbar of group 1 to true
>     end if
> end resizeStack
> -----------------
> Into the script of the stack I put this handler:
> --------------
> on openstack
>     if the width of card 1>  400 then
>        revChangeWindowSize 350,150
>     else
>        revChangeWindowSize 800,550
>     end if
>     send resizeStack to card 1 in 2 milliseconds
> end openstack
> ----------------------
> This worked for manually resizing the stack with just the handler in the
> card,  and worked for setting the stack size in the openstack handler. I had
> to add "send resizeStack to card 1 in 2 milliseconds" though.
>
> If I understand your problem this should give you an idea. The group is not
> locLocked. The fields stay in their original position, just the group size
> is adjusted and w/o scrollbar.
> (When manually changing the size of the stack I noticed that the field
> locations changed a little when increasing width and height and went back to
> the original location when making the stack window small, but this was only
> with live resizing on, with live resizing off they did not do this.)
> And thanks for "revChangeWindowSize", I did not know this one.
>
> regards
> Bernd
>    




More information about the use-livecode mailing list