preOpenStack

Richard Gaskin ambassador at fourthworld.com
Sun Sep 7 16:02:17 EDT 2014


Terence Heaford wrote:

 > Putting it in the card script does seem to be the answer.
 >
 > Had a quick look in the dictionary and I couldn’t find where it says
 > do not put it in the stack script.
 > The dictionary just says the message is sent to the destination card
 > when you open a stack.

Whether we *should* or *shouldn't* do something depends on what we want 
to do.

Once we learn the basics of the message path (in the v6.6.2 User Guide 
this is in Section 5.3.2, p127), we can anticipate the flow of messages 
and use them as we need for the task at hand.

While it may be useful to put initialization things in the first card of 
the mainstack, having commonly-used routines in the mainstack script can 
be very useful.



William Prothero wrote:

 > Interesting, but it seems counter-intuitive to have a handler that
 > references the stack being required to be on a card script.

I believe this was introduced in HyperCard, and remains a foundational 
element in most xTalks.  It's useful in allowing us to overload or 
override how messages are handled differently if we choose based on the 
context of the current card.

 > Which card? I assume it's the card that first opens in the stack?

This should always be the current card, so in a case where a stack is 
being opened the current card will be the first one.

That said, you can also open stacks via script with things like:

   open card 2 of stack "SomeStack"

...in which case the card script invoked will be for card 2, which gives 
us the flexibility of handling these sorts of messages however we might 
want for a given card.

-- 
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  Ambassador at FourthWorld.com                http://www.FourthWorld.com




More information about the use-livecode mailing list