Page 1 of 1

grouping stacks

Posted: Tue Oct 26, 2010 4:02 am
by Scott Richardson
I'm not sure how to ask this, but here goes:

Is there a practical way to "tie" two stacks together? In other words, if someone grabs the title bar of one stack's window and moves it, the other stack that is open also moves relative to the stack being moved.

Ideally, what I want to happen is that a main stack is open in the upper left default position with a sub-stack located just below it. Then, when the user presses a specified key, the main window and the sub-stack window move together to screenLoc in the same relative position to one another with the backdrop going to black. I can accomplish this on my own screen by entering the exact loc values for my screen, but I need it to work like this for all users with any size screen.

Is there some obvious way that I am blind to? This is usually my problem. Thank's in advance for any help.

Scott

Re: grouping stacks

Posted: Tue Oct 26, 2010 9:31 am
by Klaus
Hi Scott,

you can use the "movestack" message which is sent to the current card of the stack that is being moved/dragged by the user!
Like this:

Code: Select all

on movestack
   ## Only move another stack in sync if a gloabal var is true. Or a custom property or whatever :-)
   global stack_may_move
   if stack_may_move <> true then
       exit movestack
   end if

   ## Check if the other stack to be dragged is OPEN!
   if stack "the other one" is not in the openstacks then
     exit movestack
  end if

  ## Finally move the other stack together with this one:
  set the topleft of stack "the other one" to the bottomleft of this stack
end movestack
This will make the stack "the other one" "stick" to the bottom of the sack being dragged.
Of course you will need a script like this in the stack "the other one", too!

You can alsways use "relative" positions to place the other stack correctly:
the top/left/right/bottom of this stack
etc.
so no need to use "absolute" screen positions!

Hope that helps.


Best

Klaus