entry field error after 9 fields
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
entry field error after 9 fields
I have a card with 11 text entry fields that need to be numbers.
I have code for each text box to check for the enter key, return key and to make sure each key pressed is a number.
When the enter or return key is pressed focus is sent to the next desired entry field.
The code I am using is:
on returninfield
focus on field misc2
end returninfield
on enterinfield
returninfield
end enterinfield
on keyDown theKey
if theKey is not a number then beep
else pass keyDown
end keyDown
After pressing the enter Kee in the 10th field I get an error message as follows:
field "misc2": execution error at line 2 (focus: not a valid control), char 1
I don't know what to do.
thanks
Tom
I have code for each text box to check for the enter key, return key and to make sure each key pressed is a number.
When the enter or return key is pressed focus is sent to the next desired entry field.
The code I am using is:
on returninfield
focus on field misc2
end returninfield
on enterinfield
returninfield
end enterinfield
on keyDown theKey
if theKey is not a number then beep
else pass keyDown
end keyDown
After pressing the enter Kee in the 10th field I get an error message as follows:
field "misc2": execution error at line 2 (focus: not a valid control), char 1
I don't know what to do.
thanks
Tom
-
- VIP Livecode Opensource Backer
- Posts: 10052
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: entry field error after 9 fields
Where is the variable "misc2" defined?
It may be simpler to just turn on the autoTab property for each field, and then the engine will take care of the tab-on-return behavior for you automatically.
It may be simpler to just turn on the autoTab property for each field, and then the engine will take care of the tab-on-return behavior for you automatically.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: entry field error after 9 fields
misc2 is the name of the next entry field and works and is different for each field and allows focus to be in the order I want.
Thanks that works. I didn't have the "tab on Return" property checked in the offending field.
The only problem now is how do I change the order of which entry field gets the focus on the tab key.
I have removed all the code except for the On keyDown message.
Thanks
tom
Thanks that works. I didn't have the "tab on Return" property checked in the offending field.
The only problem now is how do I change the order of which entry field gets the focus on the tab key.
I have removed all the code except for the On keyDown message.
Thanks
tom
Re: entry field error after 9 fields
Hi Tom,
The fields are focused in layer order.
Simon
The fields are focused in layer order.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: entry field error after 9 fields
Hi.
You can change the layer order of the fields, so the natural progression works for you, or you can place a tabKey handler in each field that explicitly focuses on the next field you want.
Are your fields really named as numbers? This is not good practice at all. Could you rename them something like "f1,f2,f3..."? These are much easier to manage. If your fields are named in the desired order, can you write a single tabKey handler in the card script that does the refocusing? It would be a terrific learning exercise. Do try. Write back if you get stuck.
Anyway, know that a little re-thinking is really powerful sometimes.
Craig Newman
You can change the layer order of the fields, so the natural progression works for you, or you can place a tabKey handler in each field that explicitly focuses on the next field you want.
Are your fields really named as numbers? This is not good practice at all. Could you rename them something like "f1,f2,f3..."? These are much easier to manage. If your fields are named in the desired order, can you write a single tabKey handler in the card script that does the refocusing? It would be a terrific learning exercise. Do try. Write back if you get stuck.
Anyway, know that a little re-thinking is really powerful sometimes.
Craig Newman
Re: entry field error after 9 fields
I have tried to change the level of the entry fields on the card unsuccessfully.
I tries script at the entry box level and at the card level.
The code I tried is:
set the layer of "SellerN" to 1
set the layer of "PropAddr" to 2
set the layer of "City" to 3
set the layer of "salesprice" to 4
set the layer of "MortPayoff" to 5
set the layer of "commissionp" to 6
set the layer of "TransactFee" to 7
set the layer of "HOATrans" to 8
etc
Help Please
Tom
I tries script at the entry box level and at the card level.
The code I tried is:
set the layer of "SellerN" to 1
set the layer of "PropAddr" to 2
set the layer of "City" to 3
set the layer of "salesprice" to 4
set the layer of "MortPayoff" to 5
set the layer of "commissionp" to 6
set the layer of "TransactFee" to 7
set the layer of "HOATrans" to 8
etc
Help Please
Tom
Re: entry field error after 9 fields
Hi Tom,
You must include the object with that name e.g.
set the layer of field "SellerN" to 1
Using the Project Browser you can drag the objects to new layers, for simple stack it often works but I find it flaky.
The best way I find is to use the Inspector and set the layer in "Size & Position"
Simon
You must include the object with that name e.g.
set the layer of field "SellerN" to 1
Using the Project Browser you can drag the objects to new layers, for simple stack it often works but I find it flaky.
The best way I find is to use the Inspector and set the layer in "Size & Position"
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: entry field error after 9 fields
Thanks Simon, I just realized that as you posted the answer.
It sucks to be a noob
Tom
It sucks to be a noob
Tom
Re: entry field error after 9 fields
Hey Tom, don't worry with liveCode you will learn very quickly.
My favorite gotcha's:
That one is great because it almost works and looks very reasonable.
That "2" is characters to skip but it doesn't work the way I expect
And one that never actually got me but comes up here too often is that global variables have to be declared everywhere they are used.
When you come to any of those and get stumped just ask here.
Simon
Edit: This is the other big thing that comes up, saving the state of your standalone. You must write to a separate file to save changes. You haven't gotten to that point yet but I can tell you will
Keep that stack handy.
My favorite gotcha's:
Code: Select all
repeat with x = 1 to the number of lines in tVar
if "Remove this sad little line" is in line x of tVAr
delete line x of tVar
end if
end repeat
Code: Select all
offset("b","abacadabra",2) -- returns 6
And one that never actually got me but comes up here too often is that global variables have to be declared everywhere they are used.
When you come to any of those and get stumped just ask here.
Simon
Edit: This is the other big thing that comes up, saving the state of your standalone. You must write to a separate file to save changes. You haven't gotten to that point yet but I can tell you will

Keep that stack handy.
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: entry field error after 9 fields
Thanks a lot Simon.
I really am learning pretty fast.
Tom
I really am learning pretty fast.
Tom