[comp.sys.mac.hypercard] What really happens when hypercard is launched?

eacelari@phoenix.Princeton.EDU (Edward A Celarier) (07/18/90)

What I want to do:
User double clicks a stack icon; stack opens, creates a card, shows
it to the user, and places the text cursor automatically in a certain
field

How I though to do it:
Use stack script, with handlers like on openCard... on openStack...,
etc.

In particular:
	on openStack
	... (make the new card)
	click at the loc of cd fld id 4
	end openStack

What happens:
If I move into the stack from another stack (e.g. home), it works just
fine.  If I move in from outside Hypercard, the text cursor momentarily
flickers in the field, then goes away, as the disk light blinks on and
off a few times, and we are left high and dry with a hand, index finger
extended (though it might as well be the next one over).

I cannot find any documentation which states clearly and authoritatively
what happens when hypercard is launched.  It is clear that its primary
order of business is to show a card to the user, so he has something
to look at while other things are going on.  I thought I might subvert
the getHomeInfo message in the stack script, but apparently that message
(who sends it?) doesn't go that far in the hierarchy.  Somehow an 
on Idle handler seems inelegant and inappropriate (the user will do more
than fill in a single field!).

Could someone please enlighten me? 

Also:  Why is there no definitive documentation on hypercard function,
hypertext syntax, and so on?  Even Goodman, for all its weight, is 
sparse!

Thanks in advance
E. Celarier

bc@Apple.COM (bill coderre) (07/19/90)

Edward Celarier is annoyed
|I cannot find any documentation which states clearly and authoritatively
|what happens when hypercard is launched.  It is clear that its primary
|order of business is to show a card to the user, so he has something
|to look at while other things are going on.  I thought I might subvert
|the getHomeInfo message in the stack script, but apparently that message
|(who sends it?) doesn't go that far in the hierarchy.  Somehow an 
|on Idle handler seems inelegant and inappropriate (the user will do more
|than fill in a single field!).
|Also:  Why is there no definitive documentation on hypercard function,
|hypertext syntax, and so on?  Even Goodman, for all its weight, is 
|sparse!

The problem is that when Hypercard is launched, the order of messages
is somewhat backward of what some people would expect:

openStack, openBackground, openCard, startup

Since startup usually involves a covert sortie to the home stack to
read fields and set things, any text field that you might have
selected will get unselected.

You might consider trapping startup yourself, but that will disable
the home card's setup routines. So perhaps the best action to take is
to do something like:

on startup
  global hackfoo
  if hackfoo is empty then
    put "flan" into hackfoo
    send startup
    -- do your startup actions here
  else
    -- let the message go to the home stack
    pass startup
  end if
end startup

It's been a while since I did something like this, so please excuse
any typos.

gannholm@apple.com (Martin Gannholm) (07/19/90)

In article <43115@apple.Apple.COM> bc@Apple.COM (bill coderre) writes:
> The problem is that when Hypercard is launched, the order of messages
> is somewhat backward of what some people would expect:
> 
> openStack, openBackground, openCard, startup
> 
> Since startup usually involves a covert sortie to the home stack to
> read fields and set things, any text field that you might have
> selected will get unselected.

Due to problems like the one above, we changed the message order in 
HyperCard 2.0 to be "right", i.e. startUp, openStack, openBackground, 
openCard. We also changed a few other message sequences, but I can't 
remember offhand which ones.

On the note of losing a selection, however, you can save and restore the 
selection by doing something like this:
  put the selectedChunk into saveSelection
  --funky stuff here
  select saveSelection

Martin Gannholm
Apple Computer

Exclaimer! I typed this myself; my employer had nothing to do with it...

jk3t+@andrew.cmu.edu (Jonathan King) (07/20/90)

gannholm@apple.com (Martin Gannholm) writes:
> Due to problems like the one above, we changed the message order in 
> HyperCard 2.0 to be "right", i.e. startUp, openStack, openBackground, 
> openCard. We also changed a few other message sequences, but I can't 
> remember offhand which ones.

I hate to be a whiner, but if it isn't going to be obvious from the
documentation for HC 2.0, can somebody out there tell us what other
message sequences are going to change?  (I know that the startup sequence
change will probably break one stack I wrote).  Since some of these
weren't too well documented before, it would be good to know "once and
for all" what the sequences were before and will be when the magic
moment arrives.

> Martin Gannholm
> Apple Computer

jking

jkc@Apple.COM (John Kevin Calhoun) (07/20/90)

Here are the changes to message ordering in HyperCard 2.0.

  - HyperCard startup
    1.2.5:  openStack openBackground openCard startup
    2.0:    startup openStack openBackground openCard
  - Resume
    1.2.5:  openStack openBackground openCard resume
    2.0:    resume openStack openBackground openCard
  - New stack
    1.2.5:  closeCard closeBackground closeStack
            openStack openBackground openCard
            newStack
    2.0:    closeCard closeBackground closeStack
            newStack newBackground newCard
            openStack openBackground openCard
  - New stack in a new window
    1.2.5:  not available
    2.0:    suspendStack
            newStack newBackground newCard
            openStack openBackground openCard
  - New background
    1.2.5:  closeCard closeBackground
            openBackground openCard
            newBackground newCard
    2.0:    closeCard closeBackground
            newBackground newCard
            openBackground openCard
  - New card
    1.2.5:  closeCard openCard newCard
    2.0:    closeCard newCard openCard
  - Delete stack
    1.2.5:  deleteStack closeCard closeBackground closeStack
    2.0:    closeCard closeBackground closeStack deleteStack
  - Delete background
    1.2.5:  deleteBackground deleteCard closeCard closeBackground
    2.0:    closeCard closeBackground deleteCard deleteBackground
  - Delete card
    1.2.5:  deleteCard closeCard
    2.0:    closeCard [closeBackground]
            deleteCard [deleteBackground]
            [openBackground] openCard
  - Cut card
    1.2.5:  no message
    2.0:    closeCard [closeBackground]
            deleteCard [deleteBackground]
            [openBackground] openCard
  - Paste card
    1.2.5:  openCard
    2.0:    [newBackground] newCard [openBackground] openCard


Kevin Calhoun
Software Engineer
Apple Computer

sampson@cod.NOSC.MIL (Charles H. Sampson) (07/31/90)

In article <1277@idunno.Princeton.EDU> eacelari@phoenix.Princeton.EDU (Edward A Celarier) writes:
>I cannot find any documentation which states clearly and authoritatively
>what happens when hypercard is launched.
>
> [stuff deleted]
>
>Also:  Why is there no definitive documentation on hypercard function,
>hypertext syntax, and so on?
>
     I cannot find any documentation that states clearly and authoritatively
anything about Hypercard.  Please don't bring up the Addison-Wesley book.
It's good only by comparison with everything else, but its gaping holes
must be numbered in the hundreds.  This opinion is borne out by just a
casual reading of this newsgroup, when it becomes obvious that the standard
development/debugging technique in HC is "try something and see if it works."
If there were good documentation there would be a lot fewer questions sub-
mitted here.

     I don't think that the mediocrity of the documentation is the fault of
the documentors.  I suspect that Hypercard has been misnamed, that it should
be called Hyperkludge.  I looks to me like a bunch of basically good ideas
that have been cobbled together without regard to any underlying structure.
The poor documentors have come along after the fact and been given the thank-
less task of trying to make some sense of the mess.

                           Charlie Sampson