tomj@oakhill.UUCP (Tom Johnson) (03/20/90)
Once again, I don't seem to be able to make sense of something (not an unusual occurance, I assure you). This time, I'm having problems with the FIND command. Given the following scenario: 1) stack with 3 backgrounds 2) button "testFind" on bg 1 contains script below 3) card field "test" on bg 2 contains the string "abc" 4) card field "test1" on bg 3 contains the string "def" The script is: on mouseUp push card ask "Find what?" go bg {2} -- insert appropriate bg name here for bg 2 find it in field "test" if the foundText = "" then put "empty" else put the foundText pop card end mouseUp The problem: 1) If I put any of: {word | string | whole} "abc", the find works, and the msg box contains "abc" 2) If I put any of: {word | string | whole} "def", the find works, and the msg box contains "def". 3) If I put any of: {word | string | whole} "ghi", the find fails and the msg box contains "empty". I think that case 2 above **shouldn't** work! I specifically tell the find command to look for a match ONLY in field "test", but it finds the string in field "TEST1". This causes a REAL pain, since I must check in my script to verify that the foundChunk is on the card where the field I wanted to search lives every time I issue the find command. Am I reading the documentation wrong? Is there something obvious (or even not so obvious) I am missing? Incidentally, this is under HC 1.2.5 running on a Mac II/cx (8 Mb/80Mb), system 6.0.4, finder 6.1.4 (the one with "put away"). As always, thanks for any assistance in advance. Tom Johnson (tomj@oakhill.UUCP) Standard disclaimers apply.
baum@Apple.COM (Allen J. Baum) (03/21/90)
[]
>In article <3118@oakhill.UUCP> tomj@oakhill.UUCP (Tom Johnson) writes:
The problem: 'find' will find text in a field that was specifically not
asked for.
The reason: the card field name is translated to a card field number. It found
text in the field with the same number, even though it had a different name.
This is something to watch out for if you 'find' in card fields (since every
card might have different ones), or even in background fields when there is
more than one background.
--
baum@apple.com (408)974-3385
{decwrl,hplabs}!amdahl!apple!baum
man@eilat.cs.brown.edu (Mark H. Nodine) (03/21/90)
In article <39677@apple.Apple.COM>, baum@Apple.COM (Allen J. Baum) writes: |>>In article <3118@oakhill.UUCP> tomj@oakhill.UUCP (Tom Johnson) writes: |>The problem: 'find' will find text in a field that was specifically not |>asked for. |> |>The reason: the card field name is translated to a card field number. It found |>text in the field with the same number, even though it had a different name. |> |>This is something to watch out for if you 'find' in card fields (since every |>card might have different ones), or even in background fields when there is |>more than one background. Does this hold for the command sort by bg fld "Bletch" too? --Mark
jgsmith@watson.bcm.tmc.edu (James G. Smith) (03/21/90)
Find is one of the things HyperCard does in a really goofy way. If you say (in a script) Find "foo" in field "bar" HyperCard thinks hmmm, field bar is field number one, so this script says Find "foo" in field number one If hyperCard doesn't find "bar" in field number one, it goes to the next card (whatever the background) and looks for "bar" in field number one of THAT background, no matter what field that is. * (but I still like HyperTalk anyway....so what are a few hours frustation a) Find is one of the things HyperCard does in a really goofy way. If you say (in a script) Find "foo" in field "bar" HyperCard thinks hmmmm, field "bar" is field number one, so this script really says Find "foo" in field number one If HyperCard doesn't find "foo" in field number one, it goes to the next card (whatever the background) and looks for "foo" in field number one of THAT background, no matter what that field is called. * (but I still like HyperTalk anyway)
BARRY.CHERN@f200.n226.z1.FIDONET.ORG (BARRY CHERN) (03/21/90)
Tom Johnson wrote: >I think that case 2 above **shouldn't** work! I specifically tell >the find command to look for a match ONLY in field "test", >but it finds the string in field "TEST1". (These fields were on different backgrounds.) You'll probably find that field "test" and field "TEST1" have the same number. It seems that HyperCard translates your specified field name into a number and proceeds to find occurences in any field with that number regardless of name. So, you'll have to check in the script to see if a find takes place on the proper background. ^^^^^ The above statement expresses the views of the individual and does not necessarily reflect the views or concerns of this place of origin. -- BARRY CHERN via cmhGate - Net 226 fido<=>uucp gateway Col, OH UUCP: ...!osu-cis!n8emr!cmhgate!200!BARRY.CHERN INET: BARRY.CHERN@f200.n226.z1.FIDONET.ORG