[comp.sys.mac.hypercard] Trapping RETURN key

blau@ugly.cs.ubc.ca (benjamin c n lau) (02/05/89)

Does anyone out there know how to trap the return-key when the user hits
the RETURN key in a field ???
 
I know that there is no message sent to the field script if the field
property is not set to lock text. If I want to treat each line on the
scrolled field as individual line, I need to limit the number of characters
in each line and prohibit the entry of a RETURN key.
 
Thanks in advance.
 
                                            Benjamin Lau
                                            blau@ugly.cs.ubc.ca

jm7f+@andrew.cmu.edu (Joe Melvin) (02/08/89)

The following code in your field script will work:

on returnInField
  --your code here
end returnInField


You must be using HC 1.2.1 or higher for this to work.  See the release notes
on this version of HC for more info.

-Joe Melvin
jm7f@andrew.cmu.edu

annie@cs.swarthmore.edu (Annie Fetter) (02/08/89)

In article <629@ubc-cs.UUCP> blau@ugly.cs.ubc.ca (benjamin c n lau) writes:
> 
> Does anyone out there know how to trap the return-key when the user hits
> the RETURN key in a field ???
>  
>  
>                                             Benjamin Lau
>                                             blau@ugly.cs.ubc.ca

There is an XFCN called (surprisingly) TrapReturn which will do just what you
want.  I got it from BCS, so if you can't find it, send me a note and I'll
forward it to you.

	GoodLuck!
			-Annie

-- 
       Annie Fetter           |      annie@cs.swarthmore.edu    |  "We got the
VGP-Department of Mathematics |      fetter@swarthmr.bitnet     |   grant! We
    Swarthmore College        |  ...!rutgers!bpa!swatsun!annie  |    Open the
   Swarthmore, PA 19081       |         (215) 328-8225          |   champagne!"