Next: Pixmap, Previous: Entry, Up: Widgets [Contents]

### 4.5 Checkbox

The checkbox is a simple widget with a label and a check mark which can be turned on and off by the user. Checkboxes are made with the `<checkbox></checkbox>` directive.

#### 4.5.1 `<label></label>`

The label is the text shown beside the check mark. Every checkbox should have a label.

#### 4.5.2 `<default></default>`

The initial state of the checkbox can be set by the `<default>state</default>` directive, where the state can be either `yes` or `no`.

#### 4.5.3 `<action></action>`

The `<action></action>` directive tells the gtkdialog what to do, when the state of the checkbox is changed. As every widgets, the checkbox can hold multiply actions which are executed serially in the order they are written.

Actions of checkboxes can be written as conditional instructions with `if true` and `if false` prefixes as in the next example:

    <checkbox>
    	<label>This is a checkbox...</label>
    	<variable>CHECKBOX</variable>
    	<action>echo Checkbox is $CHECKBOX now.</action>
    	<action>if true enable:ENTRY</action>
    	<action>if false disable:ENTRY</action>
    </checkbox>

#### 4.5.4 `<visible></visible>`

The `<visible>state</visible>` specify the initial visibility of the checkbox. The state can be either `enabled` or `disabled`. When a checkbox is disabled, it is shaded and its state can not be altered anyway.

#### 4.5.5 `<variable></variable>`

The value of a checkbox can be `true` or `false` and depends only on its state.