Skip to content

Checkbox

Checkbox fields allow for binary selections (yes/no, true/false, etc.) The following table describes the attributes that are available for checkbox fields.

Configuration UI Checkbox Image

Attributes

Attribute Required API Version Notes
alwaysUseInDialogHeightCalc No 1.0 For dialogs that contain hidden controls (see visibleBindingId and visibleBindingValue below), setting this attribute to true will force Indigo to take hidden controls into account when initially sizing the dialog box. This is useful when hidden controls become visible based on user input.
defaultValue No 1.0 You can enter a default value here. The value must be either true or false.
enabledBindingId No 1.0 (1.9) If you want to conditionally enable/disable this field based on the value of a checkbox, set this value to the id of that field.

API v1.9: You can also bind to a list field and this field will only be enabled if something is selected in the list.
enabledBindingNegate No 1.9 Set this to "true" to negate the binding. So if the target binding field’s value is true then the binding will be false.
hidden No 1.0 If this attribute is set to true then the field will never be displayed regardless of what other options you have set for it. It’s useful if you need to contain some kind of state variables for the dialog that are controlled by button presses rather than controlled directly by the user.
id Yes 1.0 This is a unique identifier for this Field within the context of this ConfigUI element.
readonly No 1.0 This attribute will make the field readonly - useful to show the user data that changes in some other way rather than being manipulated directly by the user.
tooltip No 1.0 The tooltip will be shown when you hover over the actual list control.
type Yes 1.0 This must be "checkbox".
visibleBindingId No 1.0 If you want to conditionally show/hide this field based on the value of another field, set this value to the id of another field. If you set this, you must also include a visibleBindingValue
visibleBindingValue No 1.0 If you specify a visibleBindingId, you must specify the value(s) here. For instance, if you are binding to a checkbox, setting this to false will mean the menu field is visible only when the checkbox is unchecked, and a true means the opposite. To make the field dependent on another list or menu, set this value to a comma separated list of option values (item1, item2). You can even bind it to the value in a text field, but that’s probably of limited use. Note: the string comparison is a contains - so if any option contains the specified string it will match. This offers some extra flexibility in defining dependency groups.
<Field type="checkbox" id="checkboxSample" defaultValue="true">
    <Label>Checkbox:</Label>
    <Description>What’s on the right side of the checkbox</Description>
</Field>

Checkboxes contain the standard required Label element. They also contain an optional element, Description, that’s used to deliver extra information on the right side of the checkbox. Many checkboxes may not need this extra information.

Like button fields, you can specify a CallbackMethod element in your field definition:

<Field type="checkbox" id="myCheckbox">
    <Label>Here's a checkbox:</Label>
    <CallbackMethod>checkboxChanged</CallbackMethod>
</Field>

This method will be called every time the user clicks the checkbox. The method in your plugin.py file should look something like this:

def checkboxChanged(self, valuesDict, typeId, devId):
    # do whatever you need to here
    #   typeId is the device type specified in the Devices.xml
    #   devId is the device ID - 0 if it's a new device
    return valuesDict

Back to Configuration Dialogs