ToggleButton
Prev | Chapter 4. Buttons | Next

## ToggleButton

`ToggleButton`s are like normal `Button`s, but when clicked they remain activated, or pressed, until clicked again.

To retrieve the state of the `ToggleButton`, you can use the `get_active()` method. This returns `true` if the button is "down". You can also set the toggle button's state, with `set_active()`. Note that, if you do this, and the state actually changes, it causes the "clicked" signal to be emitted. This is usually what you want.

You can use the `toggled()` method to toggle the button, rather than forcing it to be up or down: This switches the button's state, and causes the `toggled` signal to be emitted.

`Gtk::ToggleButton` is most useful as a base class for the `Gtk::CheckButton` and `Gtk::RadioButton` classes.

Reference

Prev | Up | Next
Chapter 4. Buttons | Home | CheckButton