Navigation

    CreatiCode Scratch Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • CreatiCode

    Setting Text on Widget

    2D Blocks
    1
    1
    292
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • info-creaticode
      CreatiCode last edited by admin

       

      Prerequisite

      • The Label Widget

       

      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.

      1 Reply Last reply Reply Quote 0
      • Pinned by  info-creaticode info-creaticode 
      • First post
        Last post