gft_robert@gsbacd.uchicago.edu (01/09/90)
Date: 8 JAN 90 14:15:23 Organization: University of Chicago Graduate School of Business ----------- I'm writing a moderately complicated stack and I've run into a strange problem: my stack behaves differently when it's started up by itself (that is, when the stack itself is double-clicked) than when it's launched once one is already in HyperCard. Specifically, in my openStack handler, I set userModify to TRUE (this will eventually be running off a write-protected server) and I click in a particular field so that the user can immediately enter data. This works find if I launch the stack from within HyperCard or if I move to it from another stack. But if I launch the stack itself from the Finder, things _seem_ to get set up right (the I-bar appears in the proper field and userModify is set right), but right after openStack there's a bit of disk-trashing, and my I-bar disappears and userModify is set back to FALSE. Yo no comprendo. What could be executing after openStack? I checked the home card for the startUp handler, but it didn't really seem to contain anything that would cause this. What am I missing? Any info appreciated! Robert ============================================================================ = gft_robert@gsbacd.uchicago.edu * generic disclaimer: * "It's more fun to = = * all my opinions are * compute" = = * mine * -Kraftwerk = ============================================================================
ldo@waikato.ac.nz (Lawrence D'Oliveiro) (01/13/90)
I've come across similar behaviour myself, and I think I know what's happening: HyperCard is going to the Home stack and invoking the OpenStack handler there, *after* it's done the same for your stack! There seem to be all kinds of problems with the order in which HyperCard invokes various handlers. One case that's been bugging me for a long time now is that, when I create a new card, the OpenCard message is sent *before* the NewCard one! The way I get around this is to check, in my OpenCard handler, if certain important fields (which should have been initialised in NewCard) are still empty; if so, OpenCard exits without doing anything. Also, my NewCard handler ends with an explicit call to OpenCard. Yuk. All I can suggest is, stick a few "Answer" statements inside various handlers to help you determine the order in which HyperCard is calling them; once you've done that, *then* you can sit down and figure out what to do about it. Lawrence
taylorj@yvax.byu.edu (01/15/90)
You were on the right track when you looked at the startUp handler in the Home
stack--it's part of the problem. The main difference between starting a stack
from another stack or starting it (and HyperCard) from the Finder is that the
startUp message is added. When you start up a stack from the Finder, the
system messages are as follows:
openStack
openBackground
openCard
startUp
The problem is that startUp is sent AFTER openStack. Because there is a
handler for it in the Home stack, HyperCard temporarily leaves your stack to
run the startUp handler. This causes the insertion point (I-bar) to go away,
and also causes userModify to be set back to false.
You'd think that the easiest way to get around the problem would be to simply
intercept the startUp message, but that doesn't work (I'm not sure why). The
way I solved this very problem is with the following scripts in the first card
of the stack:
on openCard
click at the loc of card field "Name"
set the userModify to true
-- any other initial stuff
end openCard
on startUp
global initialize
put "do it" into initialize
pass startUp -- let the Home stack do its thing
end startUp
on idle --it's not a good idea to put this in the stack script
global initialize
if initialize is "do it" then
openCard
put "did it" into initialize
end if
pass idle
end idle
This is the best solution I've come up with so far. If anyone else has a
better solution, or knows more about why we have to do these silly things to
make it work right, I'd appreciate hearing about it.
Jim Taylor
Microcomputer Support for Curriculum |
Brigham Young University | Bitnet: taylorj@byuvax.bitnet
101 HRCB, Provo, UT 84602 | Internet: taylorj@yvax.byu.edu