[comp.sys.mac.hypercard] openCard msg before newCard?

u545731798ea@deneb.ucdavis.edu (L. Greg DeMichillie) (08/24/88)

This may have been covered before but here goes...

In HyperCard 1.2, why is a openCard message generated *BEFORE* a
newCard message when the user selects "New Card" from the menu?  I
have isolated this by making a stack with only 2 handlers, both at the
stack level:

  on openCard
      answer "openCard message handled"
  end openCard

  on newCard
      answer "newCard message handled"
  end newCard

When I select "New Card" the openCard dialog is displayed, THEN the newCard.
This is a real problem. I have a stack that needs to initialize certain
hidden fields when the card is opened.  If the openCard handler runs first it
finds these fields empty and croaks.  I know I could have the openCard handler
check for an empty field, but that is kind of a kludge.

-----
L. Greg DeMichillie                    "I'm not bad, I'm just drawn that way" 
u545731798ea@deneb.ucdavis.edu              - Jessica Rabbit 
lgdemichillie@deneb.ucdavis.edu   
AppleLink: ST0178

gjditchfield@violet.waterloo.edu (Glen Ditchfield) (08/26/88)

In article <2902@ucdavis.ucdavis.edu> u545731798ea@deneb.ucdavis.edu (L. Greg DeMichillie) writes:
>This may have been covered before but here goes...
>
>In HyperCard 1.2, why is a openCard message generated *BEFORE* a
>newCard message when the user selects "New Card" from the menu?

I complained about this problem in the very first released version of
HyperCard.  I even sent a complaint to hyperbug, and got an acknowledgement
back.  I had hoped that it would have been fixed by now.  Is this message
ordering an accidental result of HyperCard's implementation, or did
HyperCard's implementers do it this way deliberately?

I would really, really like to have newCard arrive before openCard.
NewCard handlers are the obvious way to perform card initialization.  I
don't think changing the relative order of the messages would break many
existing stacks.