leue@galen.crd.ge.com (Bill Leue) (03/18/91)
I know that this topic has been covered before, but as usual, I didn't pay full attention, and now that I need the info, I'm out of luck :-) Does anyone know of a "clean" way to detect the existance or non-existance of an object (like a button or field) from within a script? I have figured out a somewhat kludgey way to do it: I insert a dummy handler into the script of the card which contains the object when it is created, and test for that dummy handler if I want to see if the object was created. However, that's a somewhat unsatisfying solution. I tried testing for various properties of an object, sending various messages to it, etc., but they all brought up the "no such object" dialog if the object did not exist. For a while, I thought that the "target" function would do it, but I couldn't make that work. I guess that for me, the definition of a "clean" method would be one that relied only on the characteristics of the object itself, and not something extraneous like an auxillary script. Speaking of forgetting an old thread in this news group, what we really need (IMHO) is for someone to begin editing a Usenet Hypercard Guide, similar to Matt Mora's excellent (heroic, actually) Usenet Macintosh Programmer's Guide, to collect and collate the accumulated wisdom of the group. Another thing that would bed nice would be for someone to compile a "Hypercard One-Liners" document like Eric Pepke's (sp?) user and programmer's one-liners for the rest of the Mac. -Bill Leue leue@crd.ge.com
Susan.A.Tenney@dartmouth.edu (Susan A. Tenney) (03/19/91)
In article <17671@crdgw1.crd.ge.com> leue@galen.crd.ge.com (Bill Leue) writes:
Does anyone know of a "clean" way to detect the existance or non-existance
of an object (like a button or field) from within a script?
If you're using HyperCard 2.0, you can use the "there is" operator, as in
if there is a bg btn "Foo" then
<blah blah>
If you're not using HyperCard 2.0, the Dartmouth XCMDs stack contains an XFCN
called ObjectExists that will do the trick.
Susan Tenney
Dartmouth College Computing Services
bayes@hplvec.LVLD.HP.COM (Scott Bayes) (03/22/91)
Hypercard 2.0 has an "if there is a foo" test available. I never found a way in 1.x. Scott Bayes