Topstack and resumeStack

J. Landman Gay jacque at hyperactivesw.com
Thu Nov 7 23:43:01 EST 2002


On 11/7/02 6:33 PM, Shari wrote:
> Something presumably
> in Metacard unsets the front and back scripts if you leave the stack or 
> program.

That seems unlikely to me, though there may really be a bug. But the 
entire MetaCard UI itself is all frontscripts and backscripts, and it 
doesn't act that way. So I'd be more inclined to look at the rest of the 
code to make sure. If you can, try building a similar set of stacks and 
a standalone with nothing but a single handler that loads a backscript 
and see if the behavior is the same.

On the other hand, do you really need a backscript at all? The 
standalone stack acts the same way a HyperCard standalone does -- its 
stack is always in use. If you put the scripts into the standalone 
stack's script, they should be available everywhere, just as HyperCard's 
Home stack scripts are always available.

Another thing to look for is to make sure your frontscripts aren't 
blocking calls that the other scripts need. Frontscripts receive 
messages before any other object, and if you don't pass the message then 
no other object or stack will receive them. Does your frontscript have a 
resumeStack handler in it?

I don't have the same setup you describe, but I do have some stacks that 
use resumestack messages and they have always worked as expected.

> But when substackA of the standalone opens substackB of an external 
> stack, and you close the stack with a Cancel button or other means, the 
> resumeStack handler does not happen, and all the code is gone.

Does closing a stack run some code? If so, try taking it out as an 
experiment and see what happens.

Also, maybe the stack isn't really resuming, so it never gets the 
message. Maybe it is already the topstack, or when the first stack is 
closed, a different one comes to the front instead of the one you are 
expecting. Note that invisible stacks can still be frontmost, and the 
problem is hard to spot when that happens.

I don't know if it matters in your case, but there is a difference 
between stacks in use and backscripts. It is subtle but it can affect 
the message hierarchy. Backscripts get their messages after the home 
stack -- which in a standalone, is the main stack you used to build the 
standalone. A stack in use gets its messages *before* the home stack as 
it does in HyperCard. Therefore, if you have a handler in the standalone 
stack and one with the same name in a backscript, the one in the 
backscript will never get the message. If the backscript were instead 
located in a stack in use, the used stack would get the message and the 
handler in the standalone would never see it. Make sure your handlers 
are arranged in the hierarchy to accomodate backscripts.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the metacard mailing list