Skip to content

Selection control

Check Box

A simple parameter providing a bool value (True or False)

Parameter CheckBox

<Parameter>
    <Name>CheckBoxValue</Name>
    <Text>CheckBox</Text>
    <Value>False</Value>
    <ValueType>CheckBox</ValueType>
</Parameter>

Tip

If you want another checkbox to be deselected, when the current is being selected, you can achieve this behavior by defining an optional <Constraint> tag.

CheckBox constraint

<Parameter>
    <Name>FirstCheckBox</Name>
    <Text>First check box</Text>
    <Value>False</Value>
    <ValueType>CheckBox</ValueType>
    <Constraint>SecondCheckBox</Constraint>
</Parameter>

<Parameter>
    <Name>SecondCheckBox</Name>
    <Text>Second check box</Text>
    <Value>False</Value>
    <ValueType>CheckBox</ValueType>
    <Constraint>FirstCheckBox</Constraint>
</Parameter>

Radio Button

A parameter allowing a single choice and providing a corresponding value, which can be either integer, float or string. The <Parameter> node with the value type RadioGroup groups the child <Parameter> nodes with the type RadioButton and is the value holder for the value of the selected radio button. Within the PythonPart script (py-file), the selected value is then also accessed via this parameter.

Parameter RadioButton

<Parameter>
    <Name>RadioGroupValue</Name>
    <Text>RadioGroup</Text>
    <Value>1</Value>
    <ValueType>RadioButtonGroup</ValueType>

    <Parameter>
        <Name>RadioButtonValue1</Name>
        <Text>RadioButton</Text>
        <Value>1</Value>
        <ValueType>RadioButton</ValueType>
    </Parameter>
    <Parameter>
        <Name>RadioButtonValue2</Name>
        <Text>RadioButton</Text>
        <Value>2</Value>
        <ValueType>RadioButton</ValueType>
    </Parameter>
    <Parameter>
        <Name>RadioButtonValue3</Name>
        <Text>RadioButton</Text>
        <Value>3</Value>
        <ValueType>RadioButton</ValueType>
    </Parameter>
</Parameter>

Named tuple

It's also possible to create the RadioButton from a list of named tuples.

Parameter RadioButton

<Parameter>
    <Name>ImportFileSelection</Name>
    <Text>Import</Text>
    <Value>[_]</Value> <!--(1)!-->
    <ValueType>namedtuple(DisplayText,RadioButton)</ValueType>
    <NamedTuple>
        <TypeName>ImportFileSelection</TypeName>
        <FieldNames>RowText,FileSelection</FieldNames>
    </NamedTuple>
</Parameter>
  1. The values are filled dynamically in a script. See example PythonPart.

Example on GitHub

See the example RadioButtons ( PYP | PY)

Placeholder