[comp.sys.mac.hypercard] Strange behaviour

ralph@computing-maths.cardiff.ac.uk (Ralph Martin) (03/01/89)

I was trying to implement a "find next" button, so I thought that a simple
on mouseUp
	returnkey
end mouseUp
would do the trick. However, it doesnt. 

If I hit a find button (of the sort in the button ideas stack) and
find what I am looking for, and hit return, I get the next occurrence
of the text to be found.

If I hit a find button and find what I am looking for, and hit my find next
button, I get the SAME occurrence.

Would anyone ( Dan :-) ) like to comment on whats going on here, and why this
doesnt work as I expected? And would anyone like to tell me how they have 
implemented any find next buttons they use?

Thanks, Ralph
-- 
Dr Ralph Martin
Department of Computing Mathematics
University of Wales College of Cardiff
PO Box 916
Cardiff
CF2 4YN
United Kingdom

dan@Apple.COM (Dan Allen) (03/05/89)

In article <633@cf-cm.UUCP> ralph@computing-maths.cardiff.ac.uk (Ralph Martin) writes:
>Would anyone ( Dan :-) ) like to comment on whats going on here, and why this
>doesnt work as I expected? And would anyone like to tell me how they have 
>implemented any find next buttons they use?

Here is the script of a button that I put at the bottom of the card
right behind where the msg box is.  After I do a find and want to find
the next occurance, I just click off to the side of the msg box,


on mouseUp
  set lockScreen to true
  go next
  do msg box
  if the result is "not found" then go prev
  else unlock screen with dissolve fast
end mouseUp

This will not find on the same card more than once.  Of course if the
msg box changes to something other than the find command then the
results are unpredictable.

There are times when you want to see each occurance on a card and times
when you do not.  Find is setup for the former situation, with scripting
required for the later.

Dan Allen
Apple Computer

johnsot@nyevax.CAS.ORST.EDU (Tim G. Johnson) (03/05/89)

In article <633@cf-cm.UUCP> ralph@computing-maths.cardiff.ac.uk (Ralph Martin) writes:
>I was trying to implement a "find next" button, so I thought that a simple
>on mouseUp
>	returnkey
>end mouseUp
>would do the trick. However, it doesnt. 
>
>If I hit a find button (of the sort in the button ideas stack) and
>find what I am looking for, and hit return, I get the next occurrence
>of the text to be found.
>
>If I hit a find button and find what I am looking for, and hit my find next
>button, I get the SAME occurrence.
>

    The reason this doesn't work the way you expected is because HyperCard
assumes that you didn't want to do another 'find' as soon as you pressed
the mouse button. Before the button gets the mouseUp signal, you will
notice that the find rectangle disappears from around the found text.  When
the 'returnKey' signal is sent from the button, it executes what is in the
message box, presumably the find command, and, having starts the find from
scratch on that card, causing the same occurance as before to be found.

    As far as I know there is no way to stop the mouse from causing this,
so I just teach my users how to press the return key to find the next
occurance. I'm sure you can find some way to make this user-friendly so you
don't have to teach about the message box (maybe a field in the corner that
reflects what is being looked for, and a note under that that tells them to
press return to find next).

    Then again, maybe there is a way to do it with a button, Dan??



-- 
-Tim G. Johnson
-johnsot@mist.CS.ORST.EDU