Page 1 of 1

Move 2 stacks simultaneously on a screen ??

Posted: Sun Nov 22, 2009 7:25 am
by tareq_daher
Hello everyone,

I am trying to set the location of 2 substacks of a main stack to move at the same time in proportionate locations . So if a user clicks and drags a stack to the left (200 pixels for example) the other stack would move 200 pixels to the left ?

Thanks,

Re: Move 2 stacks simultaneously on a screen ??

Posted: Sun Nov 22, 2009 12:55 pm
by Klaus
Hi Tareq,

you can use/script the "movestack" message!
This will be sent continuously when the user moves/drags a stack.

Just put the code into the stack scripts of both stacks that should be moved together.
Something like -> Stack A:

Code: Select all

on movestack
  put the loc of this stack into locA
  put the loc of stack "B" into locB ## the OTHER stack
  ## do the necessary maths to calculate the loc of stack B in relation to the loc of stack A
  ## set the loc of stack "B" to the_computed_values
end movestack
You get the picture :)


Best

Klaus

Re: Move 2 stacks simultaneously on a screen ??

Posted: Sun Nov 22, 2009 9:21 pm
by Mark
Tareq,

Keep in mind that such solutions are very slow and ugly. You'd better re-think your interface.

Best,

Mark

Re: Move 2 stacks simultaneously on a screen ??

Posted: Sun Nov 22, 2009 9:57 pm
by FourthWorld
Before v3 they used to be ugly because the moveStack message was only sent when the move was completed on OS X, while on Win the message was sent in real time.

Now that the moveStack message is sent in real time on all platforms, these auxiliary stacks appear to move rather gracefully in synch with the one being dragged, at least here on my modest 2.1GHz Mac.

Re: Move 2 stacks simultaneously on a screen ??

Posted: Sun Nov 22, 2009 10:10 pm
by Mark
I think it still looks ugly and slow if you do something like that. Don't do it. Re-think your interface.