Stay organized with collections Save and categorize content based on your preferences.

blockly > FieldCheckbox

FieldCheckbox class

Class for a checkbox field.

Signature:

export declare class FieldCheckbox extends Field<boolean> 

Extends: Field<boolean>

Constructors

Constructor Modifiers Description
(constructor)(opt_value, opt_validator, opt_config) Constructs a new instance of the FieldCheckbox class

Properties

Property Modifiers Type Description
CHECK_CHAR

readonly

static

(not declared) Default character for the checkmark.
CURSOR string Mouse cursor style when over the hotspot that initiates editability.
SERIALIZABLE boolean Serializable fields are saved by the serializer, non-serializable fields are not. Editable fields should also be serializable.
value_ any

Methods

Method Modifiers Description
configure_(config) protected Configure the field based on the given map of options.
doClassValidation_(opt_newValue) protected Ensure that the input value is valid ('TRUE' or 'FALSE').
doValueUpdate_(newValue) protected Update the value of the field, and update the checkElement.
getDisplayText_()
getText() Get the text of this field. Used when the block is collapsed.
getValue() Get the value of this field, either 'TRUE' or 'FALSE'.
getValueBoolean() Get the boolean value of this field.
render_()
setCheckCharacter(character) Set the character used for the check mark.
showEditor_() protected Toggle the state of the checkbox on click.