Changing the width of a stack
bonnmike at gmail.com
Sun Jun 28 01:59:08 EDT 2015
Yeah, it works ok, and requires no moving of controls, no hiding either.
Heres a script I've tested with.
if sToggle is empty then put false into sToggle
put not sToggle into sToggle
put the width of this stack into sWidth -- save the width
put the formattedwidth of group 1 into tWidth -- grab the width of
the controls in the group
set the width of this stack to the width of me -- set the width
set the rect of group 1 to the rect of this card -- resize the
group. Size is locked in inspector
set the hscroll of group 1 to (tWidth / 2) - (the width of me / 2)
-- set the scroll to position the center button showing
set the width of this stack to sWidth -- set the width back
set the rect of group 1 to the rect of this card -- set the group
to match the card rect
If you have a resizable stack, you'd have to figure out how to handle
things, but with a stack that changes size with only code, its pretty
simple and seems to work ok.
I noticed another interesting thing. When resizing the group, I
accidentally typed "set the rect of group 1 of me to the rect of this card"
in the button script. And rather than giving an object not found error, it
resized the button itself to the rect of the card.
Bug right? This is in 7.0.5
More information about the Use-livecode