Scenic v0.10.2 Scenic.Component.Input.Checkbox View Source
Add a checkbox to a graph
Data
{text, checked?}
text
- must be a bitstringchecked?
- must be a boolean and indicates if the checkbox is set.
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
Buttons honor the following standard styles
:hidden
- Iffalse
the component is rendered. Iftrue
, it is skipped. The default isfalse
.:theme
- The color set used to draw. See below. The default is:dark
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
You should add/modify components via the helper functions in
Scenic.Components
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
Callback implementation for Scenic.Component.add_to_graph/3
Link to this section Functions
Link to this function
add_to_graph(graph, data \\ nil, opts \\ [])
View Source
add_to_graph(graph, data \\ nil, opts \\ [])
View Source
add_to_graph(graph :: Scenic.Graph.t(), data :: any(), opts :: list()) ::
Scenic.Graph.t()
add_to_graph(graph :: Scenic.Graph.t(), data :: any(), opts :: list()) :: Scenic.Graph.t()
Callback implementation for Scenic.Component.add_to_graph/3
.