stack script executes when opening substack

Ken Ray kray at sonsothunder.com
Thu Sep 18 15:16:42 EDT 2008


> I get what you are saying here, there is a preopen stack event in the
> main stack, which it is going to hierarchically go back to, and
> execute, because we happen to be opening a stack, and there is no
> specific preopen stack for THIS stack. I put in a blank preopen stack
> for this and it trapped it and did what I was wanting.

BTW, there's another way to accomplish this same sort of "trap" if you
*really* want to keep your preOpenStack handler in the stack script. Since
the card of a stack is what gets sent the message (before it moves along the
hierarchy), and the owner of a card is a specific stack, you can put this
code in your mainstack's stack script:

on preOpenStack
  if the owner of the target is me then
    -- this is the preOpenStack on the mainstack itself
  else
    -- this is the preOpenStack from a substack
  end if
end preOpenStack   

Just FYI,

Ken Ray
Sons of Thunder Software, Inc.
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/





More information about the use-livecode mailing list