Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • CreatiCode
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

CreatiCode Scratch Forum

  1. CreatiCode Forum
  2. Knowledge Base
  3. 2D Blocks
  4. The Checkbox Widget

The Checkbox Widget

Scheduled Pinned Locked Moved 2D Blocks
1 Posts 1 Posters 945 Views
  • 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.
  • CreatiCodeI Offline
    CreatiCodeI Offline
    CreatiCode
    wrote on last edited by admin
    #1

    Introduction

    Checkboxes are very often used in apps to allow the user to quickly input their answers to “yes/no” type of questions or configure settings on certain options.

    To add a checkbox, you can use the following block:

    093f59f6-03a0-4b29-bb6e-62c3e4da5f43-image.png

     
    X and Y are the positions of the checkbox. The last input is the name of the checkbox, which can be used to refer to this checkbox later.

     
     

    Checkbox + Label

    To show the user the meaning of each checkbox, we can add a label next to the checkbox. For example, this program would add a checkbox for the user to specify whether something is visible or not:

    1599f6fd-9afd-44b0-8e80-7fbf46b1aaed-image.png

     
     

    Set the Value of a Checkbox

    Usually, we may want to set a checkbox to be checked or unchecked by default. This can be done right after we add a checkbox. We can use the “set value to” block: a value of 0 will make the checkbox unchecked, and 1 will make it checked:

    18e6d178-2ebb-4dda-bf71-0bf02c74b6b2-image.png

     
     

    React to Value Changes

    Whenever the user clicks the checkbox, we can handle that event using the “when widget changed” block, and read the updated value of the checkbox widget.

    For example, this program will use the checkbox to control whether the sprite is shown or hidden:

    setv.gif

    1 Reply Last reply
    0

    Hello! It looks like you're interested in this conversation, but you don't have an account yet.

    Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

    With your input, this post could be even better 💗

    Register Login
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • CreatiCode