PHP-GTK
Tuesday, October 21, 2014 
download | documentation | applications | faq | changelog | resources 


search for in the  


previousGtkButton
GtkButton Constructornext

Last updated: Sun, 12 May 2013
view this page in English

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

<?php
$window = new GtkWindow;
$window->set_default_size(120,120);
 
$vbox = new GtkVBox;
 
// new Button
$button = new GtkButton;
$button->set_label('Icon Test');
$p = GdkPixbuf::new_from_file('images/publica.png');
$a = new GtkImage;
$a->set_from_pixbuf($p);
$button->set_image($a);
$vbox->pack_start($button, false, false);
 
$window->add($vbox);
$window->show_all();
Gtk::main();
?>

User Contributed Notes
gtk.gtkbutton.constructor.php
add a note about notes
There are no user contributed notes for this page.


previousGtkButton
GtkButton Constructornext

Last updated: Sun, 12 May 2013
view this page in English


credits 

PHP  Copyright © 2001-2014 The PHP Group
 All rights reserved.
Last updated: Sun May 12 20:50:56 2013 CEST