Edit field
Control "Edit field" is intended to enter a text string or a number from the keypad in the GUI. The value entered is transmitted to the controller in the corresponding field RemoteXY structure. Input field supports the input arbitrary text, integer and float values.
Transmitting data
Data | Type | Value |
For text string | ||
The entered text string | char[x] | The entered text string is UTF-8 ends in a zero, a string allocated x bytes |
For float | ||
The entered numeric value | float (32 bit) | The entered numeric value |
For integer | ||
The entered numeric value | int16_t (signed 16 bit) | The entered numeric value |
Description
"Input field" control allows to enter any text information or numerical information to the GUI screen. Input field supports three modes of input: arbitrary text value, the integer value, the float value.
When entering text, the number of bytes allocated for the string specified in the element settings. Use UTF8 encoding, that some characters allocated 2 bytes per character.
When entering float numbers you must specify the count of decimal which displayed in the edit field.
Support of type input value is performed on the step of putting value by providing the user the appropriate keyboard for input.
The edit field can contain the clear button for reset the entered value. Supported alignment of the entered text to the left, right and center.
Settings
Property | Value |
Variable name | Variable name in RemoteXY structure C++ rules |
Color | Edit field color |
Input type | Specifies the type of value. Available values: text string, float, integer. |
Length | The count of bytes allocated for the string. The system automatically adds 1 byte for the terminating zero. The property is set only for the text string. Please note that UTF8 encoding some characters occupy 2 bytes. |
Decimals | The count of decimal places displayed in the edit field. The property is set only for float values. |
Align | The horizontal alignment of the text into edit field. Available values: left, center, right. |
Show background | Show background of display edit field . |
Clear button | Show cleaning button of edit field . |
Examples of Arduino IDE
To check the string entered into the edit field equal of a defined string, you can use the following code:
if (strcmp (RemoteXY.edit_1, "OK")==0) {
// TODO entered “OK”
}
An example of how to transform the input string to a numeric data type, if used for data input arbitrary text:
For integer:
int value = atoi (RemoteXY.edit_1);
For float:
float value = atof (RemoteXY.edit_1);