Move 2 stacks simultaneously on a screen ??

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
tareq_daher
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 7
Joined: Thu Mar 05, 2009 9:24 pm

Move 2 stacks simultaneously on a screen ??

Post by tareq_daher » Sun Nov 22, 2009 7:25 am

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,
Tareq Daher (Tawaiha),
Instructional Technology, Doctoral student , UNL

Klaus
Posts: 13824
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Move 2 stacks simultaneously on a screen ??

Post by Klaus » Sun Nov 22, 2009 12:55 pm

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

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Move 2 stacks simultaneously on a screen ??

Post by Mark » Sun Nov 22, 2009 9:21 pm

Tareq,

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

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9824
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Move 2 stacks simultaneously on a screen ??

Post by FourthWorld » Sun Nov 22, 2009 9:57 pm

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.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Move 2 stacks simultaneously on a screen ??

Post by Mark » Sun Nov 22, 2009 10:10 pm

I think it still looks ugly and slow if you do something like that. Don't do it. Re-think your interface.
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Post Reply

Return to “Talking LiveCode”