Howto: Default buttons?
| From: | Benjamin Smith | Date: | Thu, 01 Jul 2004 19:52:02 +0000 |
| Subject: | Howto: Default buttons? | ||
| Groups: | php.gtk.general | ||
| Request: | Send a blank email to php-gtk-general+get-4683@lists.php.net to get a copy of this message | ||
In most apps, there's a "default button" to a dialog box. I have a picture of
such a critter at http://charterworks.net/default_button.jpg
using Gimp 1.2
(so it's apparently part of GTK)
Notice that the "Close" button has a larger border around it - if I just press
"Enter" on the keyboard, this is the button that is pressed.
I've tried to get this to work with set_relief, grab_focus, grab_default,
draw_default, no dice.
How could I modify this little script to do this in PHP-GTK?
<?
Function ShowAction($widget, $action)
{
echo $action."\n";
}
$win=&New GtkWindow();
$button1=&New GtkButton('Not Default");
$button1->Connect('clicked', 'showaction', 'Not Default');
$button2=&New GtkButton("Default");
$button2->Connect('clicked', 'showaction', 'Default');
$bbox=&New GtkHBox();
$bbox->Pack_Start($button1);
$bbox->Pack_Start($button2);
$win->Add($bbox);
$win->Show_All();
?>
--
"I kept looking around for somebody to solve the problem.
Then I realized I am somebody"
-Anonymous