Single line text entry field
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Single line text entry field
Hello all!
I want the text entry field to only accept a single line, but I can't
find the property for that. At the moment when I type a value into a field and
press enter then the cursor continues to the next line.
Regards
Roger
I want the text entry field to only accept a single line, but I can't
find the property for that. At the moment when I type a value into a field and
press enter then the cursor continues to the next line.
Regards
Roger
Re: Single line text entry field
Hi Roger,
1. welcome to the forum!
2. add an empty "dummy" script to the field(s) that will catch RETURN and ENTER like this:
If you do not "pass enterinfield" etc. the message will disappear into data nirvana 
Best
Klaus
1. welcome to the forum!

2. add an empty "dummy" script to the field(s) that will catch RETURN and ENTER like this:
Code: Select all
on returninfield
## Nada :-)
end returninfield
on enterinfield
## Also NADA :-)
end enterinfield

Best
Klaus
Re: Single line text entry field
Thanks for your fast reply Klaus!
I will try this, but have the behavior of the text entry field changed in the later
versions of LiveCode? I was reading a lesson from 2011 I think, explaining the "field" tool
and there it says that the label field and the text entry field was for single line text.
Regards
Roger
I will try this, but have the behavior of the text entry field changed in the later
versions of LiveCode? I was reading a lesson from 2011 I think, explaining the "field" tool
and there it says that the label field and the text entry field was for single line text.
Regards
Roger
Re: Single line text entry field
Hi Roger,
there is only ONE type of field in Livecode!
The Tools palette does "only" offer fields with some "pre-setup" properties, which make them look different.
Know what I mean? Example: A "listfield" is just a plain field with its "listbehavior" property (and some more) set to to TRUE etc...
Best
Klaus
there is only ONE type of field in Livecode!
The Tools palette does "only" offer fields with some "pre-setup" properties, which make them look different.
Know what I mean? Example: A "listfield" is just a plain field with its "listbehavior" property (and some more) set to to TRUE etc...
Best
Klaus
Re: Single line text entry field
You may be thinking of the autotab property (you may have the inspector set up to call it "tab on return".) Set it to true and a return or enter will move the cursor to the next field. To make that work, be sure the field height is sized to hold only one line of text.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Single line text entry field
Oh, yes, or set the fields "autotab" to true 

Re: Single line text entry field
LOL! I knew you knew that Klaus. 

Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Single line text entry field
Thanks for the help Klaus and Jacque!
Roger
Roger
Re: Single line text entry field
I know this topic is a bit stale, but I discovered another issue: even if you trap enter/return, you can still paste multi-line text into the field. To prevent this, you need to trap pasteKey as well. (And BTW, pasteKey doesn't get trapped in the IDE unless you suspend development tools.)
Since no one earlier in this thread thought of that, I'm not sure there isn't some other sneaky way to inject multiple lines into a text field. This suggests to me that there really should be a built-in attribute that enforces single-line behavior, so we don't have to write three dummy scripts (and worry that there's something we missed).
Since no one earlier in this thread thought of that, I'm not sure there isn't some other sneaky way to inject multiple lines into a text field. This suggests to me that there really should be a built-in attribute that enforces single-line behavior, so we don't have to write three dummy scripts (and worry that there's something we missed).
Ciao,
Paul
Paul
-
- VIP Livecode Opensource Backer
- Posts: 10052
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Single line text entry field
on textChanged
replace cr with space in me
end textChanged
replace cr with space in me
end textChanged
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