[comp.sys.mac.hypercard] names of buttons

rhutchin@Bonnie.ICS.UCI.EDU (02/07/91)

OK, here's another serious question.

I'm using Hypercard 2.0, OK?

I have all these buttons whose names are numbers (i.e. "1" and "2" etc.)

Inside each button's script, I have the following statement:
	global whichButton

	put short name of me into whichButton

(I meant staements)

These buttons have the effect of putting contents into a field, making
the field visible, and hiliting the button so the user can tell which
button he hit. (ther's like 30 of 'em on the card!)

In my field script, I have a handler for mouseUp, which should hide
the field and un-hilite the button.  So here's what I have:
	global whichButton

	set hilite of card button whichButton to false

Here's the problem.  I get a "Never heard of card button 100".  But
I have a button whose short name is 100!!!  So I figure that HyperCard
thinks whichButton is a number, not a name.

How do I force a container to contain a name, when it contains a number?

I have always found HyperCards treatment of numbers and strings VERY
confusing.  This is the only thing I feel needs to ever be improved
with HyperCard (besides 24-bit color cards, and maybe Apple or Claris or
whoever distributes it could bundle a 600-meg hard drive with it and
still keep it free :-)

Thanks for all your help!!!

Richard B. Hutchings
Dept of Info and Comp Sci
UC Irvine

Rob_McMurtry@mindlink.UUCP (Rob McMurtry) (02/15/91)

HyperCard provides each object with two discrete methods of id, the object id
i.e.: cd btn id 2, and the object #, i.e.: Cd btn number 2.

You _never_ reference an object by it's number, as this changes with the
addition and/or subtraction of objects. Although using names can be very
useful, the best way to reference objects is by their Id's, as these are always
dissimilar to those of other objects. Naming an object with a numeric will
cause problems. Whether this is a "problem" or not depends on your perspective,
but it's not unusual.
A practical way to name buttons and fields is to use the same name on both. If
you want a button named "info" to show a field named "info" you'd do it like
this: on mouseUp show cd fld the short name of me
end mouseUp
This can help avoid confusion, as the name of any object is always up at the
top left of the script editor.