Path: utzoo!mnetor!uunet!husc6!mailrus!ames!oliveb!felix!john From: john@felix.UUCP (John Gilbert) Newsgroups: comp.sys.mac.hypercard Subject: Re: the target Message-ID: <24353@felix.UUCP> Date: 8 Mar 88 20:00:56 GMT References: <1011@pur-phy> Sender: daemon@felix.UUCP Reply-To: john@felix.UUCP (John Gilbert) Organization: FileNet Corp., Costa Mesa, CA Lines: 64 In article <1011@pur-phy> cca@pur-phy (Charles C. Allen) writes: >I hope someone can point out my stupidity, or at least tell me that >the same thing doesn't happen with them. Otherwise, the limited >inheritance in HyperTalk is even more crippled. > > * Create a new field and put some numbers separated by commas in > it. I had 5 items in a card field in an otherwise empty > stack. > > * Now add the following script to the field: > > on test > put item 2 of the target > end test > > * Stare in dismay as nothing gets put in the message box when > you do a <> via the message > box. The problem here is that the expression "the target" evaluates to a string containing the name of the target, and the binding is such that it does not further evaluate the entire command using the name of the target. In other words, whay you are really executing here is: put item 2 of "card field blort" where "card field blort" is the actual data sent to the item function. Since there are no commas in the string, you get nuttin'. This does seem inconsistent when you consider that: get the loc of the target -- is equivalent to: get the loc of card field "blort" whereas... put item 2 of the target -- is NOT equivalent to: put item 2 of card field "blort" This seems to indicate that the expression "the target" is not to be consisered a MACRO, but an expression which is evaluated once. In your field, try: on test get the target put it end test It will show the name of the field. For my use, it seems like "the target" would have been more useful to evaluate to the contents, and require applying the function "get the name of the target" when that is what I want. However, "the target" may also refer to buttons, which do not contain values, just properties. Anyone know if there is a reasonable way to use "the target" in the case of a field to get the contents, other than using the "do" command on a string I build? John G. -- John Gilbert !trwrb!felix!john