Enter Key and Text Fields

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
starfirescully
Posts: 23
Joined: Wed Jul 09, 2014 2:35 pm

Enter Key and Text Fields

Post by starfirescully » Thu Jul 24, 2014 6:31 pm

I am having a really frustrating time with the enter key. I know that when you use it in in a text field is sends the message enterInField instead of enter. I am working on the flashcard app in livecode university.

This is what I need to happen:

When finished typing the answer in the response field. Press Enter. When enter is pressed then run mouseUp in button CheckAnswer. Here is the code I have

on enterKey
send "mouseUp" to button "CheckAnswer"
end enterKey


How can I get this to run when pressing enter in a text field instead of enterInField?

I have already tried moving the code up the message hierarchy to a group, the card, and the stack. I have literally tried everything I can think of.

Thanks in advance!

starfirescully
Posts: 23
Joined: Wed Jul 09, 2014 2:35 pm

Re: Enter Key and Text Fields

Post by starfirescully » Thu Jul 24, 2014 6:42 pm

I think I have it now!

using

on returnInField
send "mouseUp" to button "CheckAnswer"
end returninField


seems to work! :)

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Enter Key and Text Fields

Post by Klaus » Thu Jul 24, 2014 6:47 pm

Yep :D

ENTER <> RETURN!

magice
Posts: 457
Joined: Wed Mar 18, 2009 12:57 am

Re: Enter Key and Text Fields

Post by magice » Thu Jul 24, 2014 6:48 pm

starfirescully wrote:I think I have it now!

using

on returnInField
send "mouseUp" to button "CheckAnswer"
end returninField


seems to work! :)
It sounds like you ran into the same issue I did a few months back. The "enter" key is the one to the right of the number pad, not the return. It threw me until I read a tiny note in the LC dictionary.

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Enter Key and Text Fields

Post by Klaus » Thu Jul 24, 2014 6:50 pm

Get to know your hardware, guys! 8)

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Enter Key and Text Fields

Post by Simon » Sat Jul 26, 2014 3:19 am

Code: Select all

on returnInField
send "mouseUp" to button "CheckAnswer"
end returninField

on enterKey
returnInField
end enterKey
Simple

Simon
hey... who said that? :D
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Post Reply