<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[The Checkbox Widget]]></title><description><![CDATA[<h2><a class="anchor-offset" name="introduction"></a>Introduction</h2>
<p dir="auto">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.</p>
<p dir="auto">To add a checkbox, you can use the following block:</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/5e6e8b00-2124-438d-a3fe-9e6abef09f9f.png" alt="093f59f6-03a0-4b29-bb6e-62c3e4da5f43-image.png" class=" img-responsive img-markdown" width="542" height="78" /></p>
<p dir="auto"> <br />
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.</p>
<p dir="auto"> <br />
 </p>
<h2><a class="anchor-offset" name="checkbox-label"></a>Checkbox + Label</h2>
<p dir="auto">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:</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/950b1280-8182-47fd-b261-70dc26f87185.png" alt="1599f6fd-9afd-44b0-8e80-7fbf46b1aaed-image.png" class=" img-responsive img-markdown" width="925" height="219" /></p>
<p dir="auto"> <br />
 </p>
<h2><a class="anchor-offset" name="set-the-value-of-a-checkbox"></a>Set the Value of a Checkbox</h2>
<p dir="auto">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:</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/f5a98d86-2d9c-4937-9033-82f6b2857f26.png" alt="18e6d178-2ebb-4dda-bf71-0bf02c74b6b2-image.png" class=" img-responsive img-markdown" width="1240" height="279" /></p>
<p dir="auto"> <br />
 </p>
<h2><a class="anchor-offset" name="react-to-value-changes"></a>React to Value Changes</h2>
<p dir="auto">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.</p>
<p dir="auto">For example, this program will use the checkbox to control whether the sprite is shown or hidden:</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/cdffc76f-2872-47b7-879c-4667c0dbc923.gif" alt="setv.gif" class=" img-responsive img-markdown" width="775" height="467" /></p>
]]></description><link>https://forum.creaticode.com/topic/964/the-checkbox-widget</link><generator>RSS for Node</generator><lastBuildDate>Tue, 09 Jun 2026 05:53:09 GMT</lastBuildDate><atom:link href="https://forum.creaticode.com/topic/964.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 24 May 2023 03:28:25 GMT</pubDate><ttl>60</ttl></channel></rss>