Sent to the destination card when you open a stack.




on preOpenStack -- center the stack on the main screen
  set the loc of this stack to the screenLoc
  pass preOpenStack
end preOpenStack

Handle the preOpenStack message to update a card's appearance before the card appears on screen.

The preOpenStack message is sent before the openStack message. Unlike openStack, preOpenStack handlers are executed before the stack window appears. Because of this, the preOpenStack handler is a good place to put code that adjusts the size, position, and appearance of objects; the changes are made before the stack appears.

The PreOpenStack message is sent to the current card, but if it isn't the card, it's sent to the stack. So if you put the PreOpenstack both in stack and in card, only the one in the card will be executed.

If you put the PreopenStack message in the mainstack, all substack will activate it, so this could can prevent to activate the handler in substacks:

on PreOpenStack
  if the owner of the target is me then
     -- code runs for this stack only
     answer "Opened mainstack"
     -- code runs for any stack that's opened other than this one
     answer "Opened a Substack"
  end if
end PreOpenStack

The actual navigation is not triggered by the preOpenStack message, so trapping the message and not allowing it to pass does not prevent the stack from opening.

See also: openStack (message),closeStack (message),preOpenCard (message),stack (object),card (object),