[I have never worked with Maker so let me know if some of this doesn't work.]
I cannot seem to do it by using a button though. What property of the button do I bind to my tag?
The Toggle Switch and Checkbox components allow binding of their selected
property to a boolean tag.
Buttons don't have a selected
property. You would have to right-click on the component → Configure Events ... → onActionPerformed → Script and write a script to do what you want.
A two state toggle button is not offered in the version of designer I have.
Is the Toggle Switch component not there?
I don't have any components I can use to indicate the status of inputs like an LED mimic.
These are easy to generate using a Label component.
-
Create a new view. (A coordinate view will be simplest for now.)
-
Paste the Toggle Switch code below into your view.
Toggle Switch
[
{
"type": "ia.input.toggle-switch",
"version": 0,
"props": {
"label": {
"text": "Toggle switch"
}
},
"meta": {
"name": "ToggleSwitch"
},
"position": {
"x": 878,
"y": 190.5,
"rotate": {
"anchor": "75% 61%"
},
"height": 36,
"width": 189
},
"custom": {}
}
]
- Paste the lblLED code block below into your view.
Indicator label component
[
{
"type": "ia.display.label",
"version": 0,
"props": {
"style": {
"borderStyle": "solid",
"borderWidth": 1,
"borderColor": "#695858",
"borderTopLeftRadius": "50%",
"borderTopRightRadius": "50%",
"borderBottomLeftRadius": "50%",
"borderBottomRightRadius": "50%"
}
},
"meta": {
"name": "lblLED"
},
"position": {
"x": 836.5,
"y": 197,
"rotate": {
"anchor": "176% -437%"
},
"height": 32,
"width": 34
},
"custom": {},
"propConfig": {
"props.style.backgroundColor": {
"binding": {
"type": "expr",
"config": {
"expression": "{../ToggleSwitch.props.selected}"
},
"transforms": [
{
"inputType": "scalar",
"outputType": "color",
"mappings": [
{
"input": true,
"output": "#00AC00"
}
],
"fallback": "#D90000",
"type": "map"
}
]
}
}
}
}
]
- Turn on preview to try it out.
Have a look at how the binding is done on the label's backgroundColor. You'll be pointing that to a tag rather than the position of the Toggle Switch component.