gnome_score dialog - default on OK


While playing gnobots (much fun!!), the Score dialog pops up after
every game. I'd like the OK button in that dialog to be default so
you could just press Enter to get out of it.

This should be an easy thing to fix I thought, but no. Doing this,
which usually works:

  gtk_widget_grab_default (button);

gave weird results.

I also found a gnome_button_can_default function, but using this 
didn't help either. So if anyone has a clue what I'm doing wrong...
that'd be great. Here's the diff for my non-working stuff:

--- gnome-scores.c      1998/06/28 14:52:04     1.14
+++ gnome-scores.c      1998/07/24 18:59:33
@@ -115,9 +115,14 @@
        gtk_signal_connect_object (GTK_OBJECT (button1), "clicked",
                                   GTK_SIGNAL_FUNC (gtk_widget_destroy),
                                   GTK_OBJECT (gs));
+       gnome_button_can_default (GTK_BUTTON (button1), TRUE);
+       gtk_widget_grab_default (button1);
        gtk_widget_show (button1);
        hor_table     = gtk_table_new (1, clear?5:3, TRUE); 
        gtk_table_attach_defaults ( GTK_TABLE(hor_table), button1, 1, 2, 0, 1);
        gtk_widget_show (hor_table);
        if(clear) {

Simon Kågedal <> - Homepage:

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]