CheckButton


Object Hierarchy:

Gtk.CheckButton Gtk.CheckButton Gtk.CheckButton Gtk.Widget Gtk.Widget Gtk.Widget->Gtk.CheckButton GLib.InitiallyUnowned GLib.InitiallyUnowned GLib.InitiallyUnowned->Gtk.Widget GLib.Object GLib.Object GLib.Object->GLib.InitiallyUnowned Gtk.Accessible Gtk.Accessible Gtk.Accessible->Gtk.CheckButton Gtk.Accessible->Gtk.Widget Gtk.Buildable Gtk.Buildable Gtk.Buildable->Gtk.CheckButton Gtk.Buildable->Gtk.Widget Gtk.ConstraintTarget Gtk.ConstraintTarget Gtk.ConstraintTarget->Gtk.CheckButton Gtk.ConstraintTarget->Gtk.Widget Gtk.Actionable Gtk.Actionable Gtk.Actionable->Gtk.CheckButton

Description:

[ CCode ( type_id = "gtk_check_button_get_type ()" ) ]
public class CheckButton : Widget, Accessible, Actionable, Buildable, ConstraintTarget

A `GtkCheckButton` places a label next to an indicator.

![Example GtkCheckButtons](check-button.png)

A `GtkCheckButton` is created by calling either [[email protected]] or [[email protected]_with_label].

The state of a `GtkCheckButton` can be set specifically using [[email protected]_active], and retrieved using [ [email protected]_active].

Inconsistent state

In addition to "on" and "off", check buttons can be an "in between" state that is neither on nor off. This can be used e.g. when the user has selected a range of elements (such as some text or spreadsheet cells) that are affected by a check button, and the current values in that range are inconsistent.

To set a `GtkCheckButton` to inconsistent state, use [[email protected]_inconsistent].

Grouping

Check buttons can be grouped together, to form mutually exclusive groups - only one of the buttons can be toggled at a time, and toggling another one will switch the currently toggled one off.

Grouped check buttons use a different indicator, and are commonly referred to as *radio buttons*.

![Example GtkCheckButtons](radio-button.png)

To add a `GtkCheckButton` to a group, use [[email protected]_group].

CSS nodes

``` checkbutton[.text-button] ├── check ╰── [label] ```

A `GtkCheckButton` has a main node with name checkbutton. If the [[email protected]:label] or [[email protected]:child] properties are set, it contains a child widget. The indicator node is named check when no group is set, and radio if the checkbutton is grouped together with other checkbuttons.

Accessibility

`GtkCheckButton` uses the gtk_accessible_role_checkbox role.


Namespace: Gtk
Package: gtk4

Content:

Properties:

Creation methods:

Methods:

Signals:

Inherited Members:

All known members inherited from class Gtk.Widget
All known members inherited from class GLib.Object



2022 vala-language.org