Skip to main content

Text Input

The Text Input control realizes dynamic text editing. The user uses registers to control the text Input control via string variables to dynamically display the corresponding text message.

Note: The use of string variables requires that the coding rules of the project be determined in advance, which can be selected by the user in the project options of the personal space. Only if the bound variable type is string, the input content can be displayed normally.


Click the "Add Control" button in the "Edit" menu and click "Text Input" in the drop-down list of controls.

The message "Add Widget Successfully" will pop up in the upper right corner of the interface, and you can see the newly added text Input control in the "Edit Area". Select the text Input control, you can edit it in the "Properties" column.


Name, ID, Coordinate, Width, Height, Block Touch, Transform, Texture Compression Mode, Replaceable Upgrade, Texture are common properties, which are introduced in the "Basic Design - Edit Properties" section, so we won't repeat them here.

Line spacing - the distance between each line in multi-line mode.

Mode - drop-down options can be set to single line and multi-line, the default single line. Line breaks are automatic in multi-line mode, and those out of the control's range are not displayed.

Vertical Alignment - this option will be displayed only when "Mode" selects "Multi Row", there are "Align Up", "Align Center", "Align Down", "Align Down" and "Align Down". There are "Top Align", "Center" and "Bottom Align" options.

Text direction - the default "left to right", a few foreign languages need to choose "right to left";

Character range - in order to reduce the storage occupation, IDE increased the "character range" setting function, the user can be based on the need to display the text (language and text type) to expand the character range, the project encoding format is set to "UTF-8", "UTF-8", "UTF-8", "UTF-8", "UTF-8", "UTF-8". When the encoding format of the project is set to "UTF-8" (only "CJK Unified Ideographs" is supported by default) or "GB2312", you can set the character range in the font properties. After the character range is set, the character range can be selected in the character range property of the control.

Example: User set the encoding rule to "UTF-8" in the new project, add a new variable "wenben", The variable type should be set to "String ", set the string encoding length to 8, set the string encoding length to 8. Add a new variable "wenben", The variable type should be set to "String ", set the string encoding length to 8 (i.e., the maximum display of 2 Chinese characters or 8 English letters or 8 numbers, overflow will not be displayed), pay attention to the length of string encoding needs to be based on the longest text to be done to set up, if the longest text in Chinese is 10 words, then set to 40 can be The larger the value of the greater the storage occupied ; Check Enable Registers, and then bind the "wenben" variable to the text Input control. In the debugging interface, input the text to be displayed in the register value to realize the display function.



Scrolling display - default "no scrolling", after selecting "scrolling" will increase the related attributes, among which, there are two options in the default scrolling, "forced scrolling" that is, no matter how long the text will be scrolled, "overflow scrolling" that is, the text will be turned on only when the text is too long and overflows the text box. Scroll" that is, no matter how long the text will scroll, "overflow scroll" that is, the text is too long, overflow the text box will be turned on scrolling; other functional attributes and text controls described in the "scroll" function is consistent, you can refer to Text control.