Changing the width of a stack

Scott Rossi scott at tactilemedia.com
Sat Jun 27 17:56:20 EDT 2015


If I understand what you're trying to accomplish, try this:
go url "http://www.tactilemedia.com/download/setrect.livecode"


Click the colored boxes.

If you want to have the clicked object remain centered on the card, you
need to move it because a card always draws from a topLeft of 0,0.

Regards,

Scott Rossi
Creative Director
Tactile Media, UX/UI Design




On 6/27/15, 1:32 PM, "Peter Haworth" <pete at lcsql.com> wrote:

>Thanks to all for the suggestions, particularly Richmond and Mike whose
>solutions both involve moving the centered control to the left edge of the
>stack instead of trying to move the left edge of the stack to the centered
>control. The problem with globalloc and width and other stack related
>properties is they don't change the position of the left edge of the stack
>relative to the left edge of the centered control
>
>I suspected moving the centered control to the left edge of the stack
>would
>be reuired, just seems like there should be a more elegant way to do this,
>perhaps something like "position the left of stack xyz to the left of
>control abc".
>
>Pete
>
>On Sat, Jun 27, 2015 at 1:01 PM Mike Bonner <bonnmike at gmail.com> wrote:
>
>> Looks like setting the width doesn't keep the horizontal position.
>>
>> A couple options, store the location of the button too, then position
>>it at
>> the left of the card after resize, and hide any other controls that were
>> already on that left side.
>> On restore, reset the width, and move the button back.
>>
>> Heres a quicky script (that I placed in a center button for testing)
>>that
>> toggles between the two states.
>>
>> local sWidth,sToggle, sStartLoc
>> 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
>>          put the loc of me into sStartLoc
>>          set the width of this stack to the width of me
>>          set the visible of button 1 to false
>>          set the visible of button 3 to false
>>          set the left of me to the left of this card
>>          unlock screen
>>          break
>>
>>       case false
>>          lock screen
>>          set the width of this stack to sWidth
>>          set the visible of button 1 to true
>>          set the visible of button 3 to true
>>          set the loc of me to sStartLoc
>>          unlock screen
>>          break
>>    end switch
>> end mouseUp
>>
>> On Sat, Jun 27, 2015 at 1:48 PM, Alex Tweedly <alex at tweedly.net> wrote:
>>
>> > set the width of this stack to the width of theCenteredControl
>> >
>> > Alex.
>> > P.S. because the central control is centered, you want to make
>>symmetric
>> > changes to the left and right of the stack - and so simply setting the
>> > width will do that while leaving the horizontal position of it
>>unchanged.
>> > Obviously, before you do that, store away the 'current' width so you
>>can
>> > restore it later.
>> >
>> >
>> > On 27/06/2015 19:55, Peter Haworth wrote:
>> >
>> >> I have a stack with three controls on it, one at the left edge of the
>> >> stack, one centered horizontally, and one at the right edge of the
>> stack.
>> >>
>> >> I want to change the dimensions of the stack so that it's left edge
>>is
>> at
>> >> the left of the centered control and its right edge is at the right
>>of
>> the
>> >> centered control. And also change its dimensions back to the original
>> >> settings when necessary.
>> >>
>> >> As I have a graphically challenged brain, I have been unable to
>>figure
>> out
>> >> how to do this.
>> >>
>> >> References to the left of a  stack are relative to the edge of the
>> screen
>> >> so they move the position of the stack on the screen and don't change
>> its
>> >> width.
>> >>
>> >> I'm probably missing something obvious and hoping that someone will
>> point
>> >> it out to me.
>> >>
>> >> Pete
>> >> _______________________________________________
>> >> 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
>> >>
>> >
>> >
>> > _______________________________________________
>> > 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
>> >
>> _______________________________________________
>> 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
>>
>_______________________________________________
>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