editable fields and the return key
editable fields ReturnKey

randy Smith wrote on direct-L:

> I have a project which uses an editable field for login entry. I am using
> getPrefs and setPrefs for this function and it is working fine. But only
> works on mouse click only. The RETURN key doesn't invoke the code when the
> field is editable. It does if the field isn't editable (which defeats the
> purpose of user login).

A couple of text field properties have been overlooked...

First of all the way that editable fields work is that when a field is set
to be "editable", the user can type in the field and from that point on, all
keydown events stop unless specifically passed. Since your on keydown
handler is in the exitframe it never receives the key event. Conversely,
when your field is NOT editable, it doesn't receive key events but the "on
keydown" in the frame script does.

So the first thing to remember is that when a field is editable, it can
receive key events. When its not editable it can't.

I think you'll find it easier if you put your "on keydown" script on the
field in the score as a behavior instead of having it in the frame script.
Also note that in your case statement you need a ":" after the "RETURN".

-- behavior on field you want user to type in
on keydown
  sLogin = the text of member "Text field"
  case the key of
      alert sLogin
      --      alert "!"
      -- the "pass" command allows characters other than RETURN to be
      -- entered in the text field as the user types.
  end case

Hope this helps,

> I did a test seperate to the project to see when the field would allow the
> RETURN key to be invoked. I used the following frame script:
> on exitFrame
> go to the frame
> end
> on keydown me
> sLogin = the text of member "Text field"
> case the key of
> alert sLogin
> otherwise
> alert "!"
> end case
> end
> Is there anything I am missing here? Is there some Lingo that I can use to
> allow it to work? A big thankyou in advance.

Home shock + cgi Bits 'n pieces Director Lingo ShockLets Contact