[Gtk-sharp-list] Gtk.Dialog

Sergio Duran Sergio Duran <sergioduran@gmail.com>
Mon, 22 Nov 2004 00:13:14 -0600


OK, here's the thing...

I create a simple dialog with glade, it only has a Gtk.Entry, which
has ActivatesDefault=true, and the Ok button on the ActionArea has
hasDefault=true
I load and autoconnect the gxml object and I get a dialog, when I
press enter on the Gtk.Entry, the OK button is activated.

Now, I write it using Gtk#:

Dialog dialog;
dialog = new Dialog();
dialog.Modal=true;
dialog.Title="dialog";
Entry entry = new Entry();
entry.ActivatesDefault=true;
dialog.VBox.Add(entry);

Button button=new Button(Stock.Ok);
button.HasDefault=true;
dialog.AddActionWidget(button, ResponseType.Ok);
dialog.ShowAll();
dialog.Response += new ResponseHandler(handleResponse);
dialog.Run();

but the Ok button doesn't get activated when I press enter, is there
something I'm doing wrong? should I create a entry.Activated += new
EventHandler that calls button.Activate();?
Do I have to add an accelerator on the enter key, linked to the button?

Thanks, cheers.