Page 1 of 1

changing focus

Posted: Wed Aug 21, 2013 1:09 am
by byg
Hi, I have a stack with three text entry field called WINS, LOSSES, RESULT. I
want to be able to enter number in WINS and when pressing Enter the focus would
go to LOSSES and then I would enter number in LOSSES and then clicking a button
would get me the result.

Here is what I've done in the card script I have
- on opencard
focus on field wins
end opencard
this works.

then I used in the WINS text entry field script
- on returnkey
focus on field losses
end returnkey
this does not work, it only erase my entry and focus stays in WINS. No errors

If I use button to change focus this works but I thought just having the text
field looks cleaner.
I've read all I could on FOCUS and RETURNKEY but it did not help. I am fairly new at using LiveCode and know there is probably better ways to do what I want. Can anybody stir me the right way. TIA
byg

Re: changing focus

Posted: Wed Aug 21, 2013 1:27 am
by Simon
Hi byg,
Welcome to the forum!

LC has this one all sorted out for you!
In the property inspector of the field select "Tab on Return", you'll have to do this for each of your fields.
Don't forget to remove your "on return" scripts.

Tip: The cursor will jump to the next field determined by it's (layer) level. If you just move them around on your stack it will always jump to the same field, unless you change it's level.

Simon

Re: changing focus

Posted: Wed Aug 21, 2013 1:44 am
by byg
thanks Simon, that works great, so simple when you know it. I will have to tick that one on my learning curve. Thanks again.
byg