Setting Text on Widget
-
Prerequisite
Description
You can change the text written on any widget using the 2 blocks introduced below.
Setting Text Directly
This block allows you to set the value of any widget. Note that the “value” may mean different things for different types of widgets. For a label, its value is just the text on it, so when we set a new value for a label widget, it will replace the existing text on that label:
Parameters
- New Value: The new value you want to set for the widget (such as a label)
- Widget name: You need to select which widget you want to change. That widget has to be added to the stage already for its name to show up in this list.
Appending Text After Existing Text
This block allows you to keep the existing text written in any widget, and append new text after it:
Parameters
- Text to Append: Text string to be appended.
- Widget name: You need to select which widget you want to change. That widget has to be added to the stage already for its name to show up in this list.
Demo
This screencast shows how to use these 2 blocks to update the text on a label. Note that when you append new text, you may need to start with a SPACE letter.
-