| Newsgroups |
php.gtk.webmaster |
| Message-ID |
<[email protected]> |
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