Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!unmvax!ncar!tank!nucsrl!accuvax.nwu.edu!mcgee
From: mcgee@nuacc.acns.nwu.edu (Randy McGee)
Newsgroups: comp.sys.mac.hypercard
Subject: Question about the startUp message
Message-ID: <406@accuvax.nwu.edu.NWU.EDU>
Date: 8 Dec 88 15:58:26 GMT
Sender: news@accuvax.nwu.edu.NWU.EDU
Organization: Northwestern University - Evanston, IL
Lines: 34

I've been playing around with a startUp handler lately and am having some 
problems.  One of the things I'm trying to do in this stack is ensure that 
the userLevel is set to 3.  Since the normal hierarchy would execute my stack 
startUp handler first (assuming you open the stack from the finder of course) 
and then the Home stack handler, the userlevel is "set" according to the 
preference card.

I thought of two ways around this.  One was simply to copy the Home stack 
startUp script into my startUp script.  This works, but I'd rather not do 
this since it may change in the future and would be a maintenance problem.

The second was simply to send the startUp message to the Home stack.  The 
problem here is that when I do this, HyperCard goes into a loop until it stop 
with a recursion limit error.  After playing around for a while and putting 
some debugging puts into my handler, I've determined that sending the startUp 
message to the Home stack somehow ends up calling my stack handler again!  
This is contrary to the normal progression of messages through the 
hierarchy.

Is this a bug or just a screwy side effect of how startUp messages work.  If 
it's not a bug, does anyone have a GOOD work around suggestion?  I've found 
two work arounds, but don't like either.  One is to copy the Home stack 
script as described above.  The other is to use a global variable to hold a 
boolean as to weather my startUp handler has executed yet to conditionaly 
send the startup message to the Home stack.

Thanks for any and all suggestions.


P.S.   I've tried this on both version 1.1 and 1.2 of HyperCard.

Randy McGee (MAGOO)      Phone:    (312) 491 4079
Academic Computing and Network Services            USPost:   2129 Sheridan Road
Northwestern University                                      Evanston, IL  60208