View Source Scenic.Component.Input.Checkbox (Scenic v0.11.2)

Add a checkbox to a graph

data

Data

{text, checked?}

  • text - must be a bitstring
  • checked? - must be a boolean and indicates if the checkbox is set.

messages

Messages

When the state of the checkbox, it sends an event message to the host scene in the form of:

{:value_changed, id, checked?}

styles

Styles

Buttons honor the following styles

  • :hidden - If false the component is rendered. If true, it is skipped. The default is false.
  • :theme - The color set used to draw. See below. The default is :dark

theme

Theme

Checkboxes work well with the following predefined themes: :light, :dark

To pass in a custom theme, supply a map with at least the following entries:

  • :text - the color of the text in the button
  • :background - the background of the box
  • :border - the border of the box
  • :active - the border of the box while the button is pressed
  • :thumb - the color of the check mark itself

usage

Usage

You should add/modify components via the helper functions in Scenic.Components

examples

Examples

The following example creates a checkbox and positions it on the screen.

graph
|> checkbox({"Example", true}, id: :checkbox_id, translate: {20, 20})

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Link to this section Functions

Link to this function

add_to_graph(graph, data, opts \\ [])

View Source

Callback implementation for Scenic.Component.add_to_graph/3.

Returns a specification to start this module under a supervisor.

See Supervisor.