[comp.sys.mac.hypercard] finding in HyperCard

PROMAN%UVVM.BITNET@CORNELLC.cit.cornell.edu (Paul Romaniuk) (04/17/89)

Robin:

Here's one way to implement Find/Find Next buttons in HyperCard:

for the "FIND" button use the script:

on mouseUp
  global searchTerm
  Ask "Find what?" with searchTerm
  if it is empty then exit mouseUp
  put it into searchTerm
  find searchTerm
end mouseUp

for the "FIND NEXT" button use the script:

on mouseUp
  global searchTerm
  set lockScreen to true
  go to next card
  find searchTerm
  set lockScreen to false
end mouseUp

to make sure the user gets the correct result if he hits the
returnKey, put the following script in the background or stack level:

on returnKey
  send mouseUp to bkgnd button "FIND NEXT"
  pass returnKey
end returnKey

If you want to get fancy, you can keep track of the first hit of the
search, and stop searching once the user has cycled back to the first
hit.

Paul Romaniuk,
University of Victoria,
PROMAN@UVVM