Changing the width of a stack

Peter Haworth pete at lcsql.com
Sun Jun 28 19:51:47 EDT 2015


Thanks Mike.  Good to have more than one way to do this.

On Sat, Jun 27, 2015 at 10:59 PM Mike Bonner <bonnmike at gmail.com> wrote:

> Yeah, it works ok, and requires no moving of controls, no hiding either.
>
> Heres a script I've tested with.
>
> local sWidth,sToggle
> on mouseUp
>    if sToggle is empty then put false into sToggle
>    put not sToggle into sToggle
>
>    switch sToggle
>       case true
>          lock screen
>          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
>
>          unlock screen
>          break
>
>       case false
>          lock screen
>          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
>          unlock screen
>          break
>    end switch
> end mouseUp
>
> 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
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list