note 604 added to gtk.gtkbutton.php
| From: | stivi at rotop dot com | Date: | Mon, 07 Nov 2005 18:28:34 +0000 |
| Subject: | note 604 added to gtk.gtkbutton.php | ||
| Groups: | php.gtk.webmaster | ||
| Request: | Send a blank email to php-gtk-webmaster+get-2861@lists.php.net to get a copy of this message | ||
I have tried the example above but it has some errors.
<?php
Function ShowAction($widget, $action)
{
echo $action."\n";
}
$win=&New GtkWindow();
//Old: $button1=&New GtkButton('Not Default");
$button1=&New GtkButton("Not Default");
//Old: $button1->Connect('clicked', howaction', 'Not Default');
$button1->connect('clicked', 'showaction', 'Not Default');
$button2=&New GtkButton("Default");
$button2->Connect('clicked', 'ShowAction', 'Default');
// THIS NEXT LINE IS THE KEY
$button2->Set_Flags(GTK_CAN_DEFAULT); // <===========
$bbox=&New GtkHBox();
$bbox->Pack_Start($button1);
$bbox->Pack_Start($button2);
$win->Add($bbox);
$win->Show_All();
//Use this function to display the Gtk window adn buttons
gtk::main();
// It seems this has to come AFTER the last "->Add()" call...
// <=============
$button2->Grab_Default();
?>
http://gtk.php.net:80/manual/en/gtk.gtkbutton.php