[comp.sys.mac.hypercard] Problem while modifying "find"

ollef@sics.se (Olle Furberg) (01/17/91)

  I was trying to modify the behavoir of the find-commmand in one
of my stacks. I wanted to intercept it, and check if it really did find
anything. If the result was "not found" I would force it to continue
the search in another stack, called "verb".

  After more than one hour of HT-hacking I've given up. This shouldn't 
be so hard to do, but I just can't see it, plz help me!

  Below I have three scripts. The first doesn't seems to do anything.

  The second does what I want to do, but it doesn't intercept the find-cmd.

  The third script is an example of a feature/bug of the HT-compiler (I 
guess?). I remember there was some discussion about this some weeks before,
but I can't recall the result of the discussion. In some situations HC
seems to execute "go"-statements in advance (before the preceding lines).


---This doesn't work at all
on find what
  send find && what to hypercard
  if the result is not empty then
    if hilite of bg btn "Find verb" then
      go verb
      send find && what to hypercard
    end if
  end if
end find
 
 
 
-- This one works but I really want to intercept the "find"-
-- command, not creat a new one.
 
on LookFor what
  send find && what to hypercard      ---(Yea, "find what" is enough)
  if the result is not empty then
    if hilite of bg btn "Find verb" then
      go verb
      send find && what to hypercard
    end if
  end if
end LookFor
 
 

--   In this script: if the button "Find verb" is hilited, this script
-- seems to jump to stack "verb" before it executes the very test! In
-- that situation it stops the execution (while being on the "verb"
-- stack and complains "Can't find any btn 'Find verb'!" (That button
-- is on the first stack, from where the script is executed.)
--   If the btn is not hilited it doesn't go to the stack.
--   If "find what" is replaced by "send find && what to hypercard", HC goes
-- to stack "verb" without complaining.

 
on find what
  send find && what to hypercard
  if the result is not empty then
    if hilite of bg btn "Find verb" then
      go verb
      find what -- this was a small blunder, I forgot "send..."
    end if
  end if
end find