[comp.sys.mac.hypercard] How to copy a card without generating unique bkg?

swenson@aulait.Stanford.EDU (Norman Swenson) (01/27/89)

In article <377@isl.stanford.edu> I wrote:
>
>Fair enough!  If you change the bkg, even one pixel, you get a new bkg id.
>But I didn't change _ANYTHING_!

In article <8455@orstcs.CS.ORST.EDU> johnsot@jacobs.CS.ORST.EDU.UUCP
(Tim G. Johnson) responded:
>
> Ok, it is obvious that you haven't
>changed anything, but the background may have been changed by a
>CloseCard script when you went to the last card of the stack. Things
>to look for are changing the hilite of a button or something
>obscure like that....That would explain why it works sometimes and
>sometimes it doesn't, if the script conditionally changes the hilite
>of a button. 
>

Excellent advice, Tim.  _I_ didn't change _ANYTHING_.  Unfortunately,
the script I wrote _DID_.  You were absolutely right, except that the
offending script was an On OpenCard handler.  Since this may bite
somebody in the future, I'll elaborate.  The following OpenCard
handler (which is in the bkg script) sets the hilite of a background
check box button to the contents of a hidden fld:

set the hilite of bg button "read" to (fld "readfld" is true)

A closecard handler stores the hilite of bg button "read" in fld "readfld".
When I cut the card to move it, the hilite of "read" was always false.
When I went to the last card, the last card received an OpenCard
message.  Hence if "readfld" in the last card contained true, the
hilite of "read" was set to true for that bg.  If this bg happended to
be the bg of the card I cut, I (or I mean the script :-)) just changed it,
resulting in a unique ID when I pasted.   You can see why I would
sometimes get a unique ID, and other times I wouldn't, depending on
the bg of the last card and the contents of readfld on that card.

Thanks to those providing advice.  My apologies for cluttering the net
with this.  Hopefully it was instructive for others.  I know it was
for me.  I guess experience (and a good dose of public humiliation) is
still the best teacher.

Now, why can't I get "find exp in fld fldname" to work with multiple bkgs?

Norm
swenson@isl.stanford.edu

JINTEIK@ITIVAX.Bitnet (04/18/89)

>> [When copying cards,] how does HC decide when to assign a new id to the
>>bkg?

>So if Hypercard creates a new background, -something- was different.
>(Note:  Unfortunately, there isn't really a good way to move a card
>        onto a different background.  This makes the duplicate bkgnds
>        problem, ehh, more of a problem).

Wouldn't it be neat for HC2.01 to have a Option-Paste to paste a background
with the same id? That way, the pasted card will always inherit the
same original background even though the background may have changed,
be it script of picture.

I'm sure there are cases when both scenerios would be useful.

-----------------------------------------------------------------
J.T. Teh
Systems Engineer - Macintosh Development Group
Information Technology Institute
NCB Building, 71 Science Park Drive, Republic of Singapore 0511.

BitNet Address:   jinteik@itivax.bitnet
Internet Address: jinteik%itivax.bitnet@cunyvm.cuny.edu

Disclaimer: "My opinions are mine! All mine!" (Merry chuckle!)
-----------------------------------------------------------------