The Textbox Widget
CreatiCode last edited by info-creaticode
You can use a textbox to allow the user to input some text, such as some comments, a chat message or a number.
- Center Position: The x and y positions of the center point of the textbox.
- Size: The width and height of the textbox. Note that the textbox is limited to the stage window, which has a width of 480 and a height of 360.
- Padding: how much space on the left and right margin of the text.
- Line Mode: Whether there is only one line of text, or there can be multiple lines. If there is only a single line, then it will be positioned in the middle of the textbox, and the enter keys will be ignored when the user types in the textbox.
- Scroll Mode: When there are too many lines of text, whether there will be a scrollbar to scroll the textbox vertically.
- Input Mode: Whether the user can type in the textbox, or it is read-only.
- Textbox Name: A unique name to refer to this textbox later.
You can read the content of a textbox using this block:
- Widget Name: You need to select the widget to read the value from. For a textbox, its value is the text in it.
You can listen to the event that the value of a widget has changed. For textboxes, whenever the text in it changes, this event will be triggered.
- Widget Name: You need to select the textbox to watch for the change events.
In this project, we add a textbox and a label. As we type in the textbox, its value changes, and when that event is triggered, we set the text of the label to be the content of the textbox.