Reply to:   Catching the Enter/Return Key

>I'm new to the this listserv and new to Director, so please let me know if I
>deviate from your conventions.
>
Always put a subject to your posts

>
>on keyUp
>  if the key = RETURN then
>      answer = member("input field large").text
>      if answer = "C" Then
>          go "symbol correct"
>      else
>          go "symbol incorrect"
>      end if
>  end if
>end
>
>Typing "C" does not yield the correct response. If I put the same code
>(without the key = RETURN lines) under a button, it works fine. The
>ENTER/RETURN key seems to change the text. Any ideas on how I make this
>work? I don't want to use "contains" because I don't want "Ca" to be
>considered correct.
>

You want to catch the enter key before it get entered into the text box.  By the time 
'keyUp' is issued this has already occurred.

Try using 'keyDown' and also look at 'stopEvent' and 'pass' to control the message 
continuing along the message hierarchy.

Here are the untested changes to your code

on keyDown
  if the key = RETURN then
      answer = member("input field large").text
      if answer = "C" Then
          go "symbol correct"
      else
          go "symbol incorrect"
      end if
      stopEvent
  else
      pass
  end if
end



johnAq



[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to