Edit
An Edit is a field used to show and alter texts. Also known as UITextField on Swift and input on HTML. There also is some variations, like Outlined Edit, Calculator Edit, Password Edit, etc.
Last updated
An Edit is a field used to show and alter texts. Also known as UITextField on Swift and input on HTML. There also is some variations, like Outlined Edit, Calculator Edit, Password Edit, etc.
Last updated
In most applications is necessary to remove the background from the object and change the color of the element so that it is better viewed.
In some situations, entry should be limited to numbers.
If the entry is a password, it should not be possible to see it.
To receive different input formats, which are not predefined in TotalCross.
See also our quick tutorial video on creating Edits.
See the Java Docs for more information.
Type
Name
Description
String
clearValueStr
stores the value that will be used by the clear() method to switch texts
Byte
captalise
used to modify the the letter case from the text within the Edit:
ALL_NORMAL: normal case
ALL_LOWER: all lowercase
ALL_UPPER: all uppercase
String
caption
The Edit's placeholder text
boolean
forceBackgroundColor
forces the edit tu use the background color on it, must be used with UIColors.sameColors setted to true
Type
Name
Description
Constructor
Edit( )
Creates a box for user input
Constructor
Edit(String mask)
Creates a box for user input, but with a mask
void
setMode(byte mode)
Used to change the mode value to one of the accepted ones by the mode constants, without masking. To enable masking, you should use the setMode(byte mode, boolean maskedEdit) method, and pass the mode you wish and true on the second parameter
void
setEditable(boolean on)
will enable or disable the Edit. Can be used as a way to make sure the user don't modify something that was already saved on server and can't be modified without proper authorization
String
getText( )
Returns the text within the Edit, without care for the mask. It's important to note that in the case where there is mask, the characters from the mask will come with the user input, to get only the user input you should be using the getTextWithoutMask() method to recover the text
void
setMaxLength()
Is used to limit the characters number the user can digit on the text field
void
setPrediction(boolean prediction)
Is used to set if there should or not exist prediction on this Edit, it is, however set to true by default.