GtkButton Constructor

GtkButton (string label, boolean use_underline);

Creates a new GtkButton widget, the content of which is dependant on the parameters label and use_underline. The default values are null and true respectively.

label is the text to be displayed in the button. If you want to display anything other than a GtkLabel in the button, create the button without passing any parameters and add the widget at a later stage.

use_underline, if true, means that an underscore in the label text will flag the next character as the mnemonic accelerator key, if it is the first character so marked. This is the default behaviour in PHP-GTK 2; you can switch it off by passing 0 or false as the second parameter.

The mnemonic character is used as the keyboard accelerator for the button when pressed simultaneously with the Alt key.

Example 20. A button example

$window = new GtkWindow;

$vbox = new GtkVBox;

// new Button
$button = new GtkButton;
$button->set_label('Icon Test');
$p = GdkPixbuf::new_from_file('images/publica.png');
$a = new GtkImage;
$vbox->pack_start($button, false, false);