GtkToggleButton Constructor

GtkToggleButton ([string label [, boolean use_underline = true]]);

Creates a new GtkToggleButton, optionally with a text label. If you pass false as second parameter, the mnemonics (_) will not be parsed.

Example 123. Creating a new GtkToggleButton

//Create a new toggle button with label and mnemonic
$togglebtn = new GtkToggleButton('Toggle _me');
//connect the toggled signal to the function "toggled"
$togglebtn->connect('toggled', 'toggled');

function toggled($togglebtn) {
    if ($togglebtn->get_active()) {
        echo "ToggleButton is ACTIVE\r\n";
    } else {
        echo "ToggleButton is NOT active\r\n";

$wnd = new GtkWindow();
$wnd->connect_simple('destroy', array('gtk', 'main_quit'));