Skip to main content

Checkbox

Element type: Dictionary

Shows one or several checkboxes with text on the right.

Keys

NameTypePossible valuesRequired
TypeStringInputRequired
InputTypeStringCheckboxesRequired
VariableString-Required
LabelString-
LabelFontConfigurationDictionary (Font)-
DistributionStringFit, Center
PercentWidthNumber0...1
AlignmentStringLeft, Center, Right
StyleStringCheckbox, Switch
ItemsArray(String) or Array(Number)Required
ValidationDictionary
MarginsDictionary (Margins)-
BorderDictionary (Border)-
Condition PRODictionary (Condition)-

Detail

Type Required

Type: String
Explanation: The type of the component has to be Input.

InputType Required

Type: String
Explanation: The type of the component which has to be Checkboxes.

Variable Required

Type: String
Explanation: The variable used within the application and as a key in the input file Octory will create to let you retrieve the user inputs.

Label

Type: String
Explanation: The label lets you give some insight to the end user about the value they need to enter. Its text will generally be placed on the left side of the input field.

info

If you do not specify a label, the input field will be centered. To keep the alignment with other input components which have a label, give the Label a whitespace for value.

LabelFontConfiguration

Type: Dictionary (Font)
Explanation: Let you specify the font configuration to use. Default is "DefaultPrimary" if specified in the Font styles in the configuration file, or system font otherwise.

Distribution

Type: String
Possible values: Fit, Center
Default: Center
Explanation: Specify how the label and the input field are stacked.

  • Fit gives them as much space as they need, but the input component will not be aligned with the other ones.
  • Center align the label and the input field in the horizontal middle of its container. This allows several input components to be aligned, although it may crop the text label.

PercentWidth

Type: Number
Possible values: 0...1
Explanation: This value allows you to give more width to an input component, by specifying the percentage width it should take in its container. Default is most often 0.4.

Alignment

Type: String
Possible values: Left, Center, Right
Availability: 3.1.0+
Explanation: Moves the label and the control together, as a single cluster, to the chosen edge of the row.

info

This key has no default. When it is absent, the input keeps the historical placement driven by Distribution and PercentWidth, so existing configurations are unchanged.

Alignment is independent from Distribution: Distribution decides how wide the label and the control are, Alignment decides where that cluster sits in the row. Note that a labeled input using Distribution set to Center keeps its right aligned label only while Alignment is absent.

Style

Type: String
Possible values: Checkbox, Switch
Default: Checkbox
Availability: 3.1.0+
Explanation: How each item's control is drawn. Checkbox keeps the classic checkbox, Switch renders each item as a macOS switch.

info

Only the appearance changes. The values are saved under the same {Variable}-{index} names, the mandatory validation rule is unchanged, and a previously saved value is restored the same way.

A switch is drawn right after its item title, at the title's natural width, so items with titles of different lengths show their switches at different horizontal positions. Checkbox glyphs stay aligned on the left edge.

Items Required

Type: Array(String) or Array(Number)
Explanation: Array of choices to propose to the end user. All the values need to have the same type to let Octory infer it. You can chose an array of String or Number. If Number is chosen, you can write Int or Real values, but you cannot mix them.

Validation

Type: Dictionary
Explanation: Let you force the user to check all boxes of a Checkboxes input component.

Input Text Validation

NameTypeRequired
WarningTextString
FontConfigurationDictionary (Font)

WarningText

Type: String
Explanation: The text to display to the user when the input is empty or its value is incorrect. Default is "Incorrect or empty value".

FontConfiguration

Type: Dictionary (Font)
Explanation: The font configuration to use for the warning text.

Margins

Type: Dictionary (Margins)
Explanation: Add padding to the component's sides.

Border

Type: Dictionary (Border)
Explanation: Add a top or bottom border to a component.

Condition PRO

Type: Dictionary (Condition)
Explanation: Allows to hide or show the component using a boolean expression.

Example

Checkboxes to ask to the user to describe his feelings. Each box is optional.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- ... -->
<key>Slides</key>
<array>
<dict>
<key>Containers</key>
<array>
<dict>
<key>Components</key>
<array>
<dict>
<key>Type</key>
<string>Input</string>
<key>InputType</key>
<string>Checkboxes</string>
<key>Variable</key>
<string>UserAdjectives</string>
<key>Label</key>
<string>How are you feeling?</string>
<key>Items</key>
<array>
<string>Impatient</string>
<string>Ready to start</string>
<string>Nervous</string>
</array>
</dict>
</array>
</dict>
</array>
</dict>
</array>
<!-- ... -->
</dict>
</plist>

Checkboxes which needs to be checked by the user to validate.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- ... -->
<key>Slides</key>
<array>
<dict>
<key>Containers</key>
<array>
<dict>
<key>Components</key>
<array>
<dict>
<key>Type</key>
<string>Input</string>
<key>InputType</key>
<string>Checkboxes</string>
<key>Variable</key>
<string>SecretSpy</string>
<key>Validation</key>
<dict>
<key>WarningText</key>
<string>Please agree, M. Hunt.</string>
</dict>
<key>Items</key>
<array>
<string>I acknowledge that my activity would be denied by the government if I was arrested</string>
</array>
</dict>
</array>
</dict>
</array>
</dict>
</array>
<!-- ... -->
</dict>
</plist>

About checkboxes variable

As the checkboxes input component can have two states for each of its item, Octory will create a variable for each item, with the state as value (true/false for check/uncheck). With the first example, Octory will create 3 variables with the index of the checkbox and the variable name:

  • UserAdjectives-0 for the Impatient option
  • UserAdjectives-1 for the Ready to start option
  • UserAdjectives-2 for the Nervous option