On Fri, 2007-08-24 at 17:27 -0400, William Ramsay wrote: > Hi, > > Can anyone explain to me how to go about handling the pressing of the > return key > in a data entry dialog? For instance, when the user is done entering > data, pressing > the Enter button on the keyboard should fire the OK button on the dialog. > > I can capture the "click" event easily enough. And I can capture the > "key_press_event" > and check to make sure it's a Return key, but how do I connect the two > events to > the same GTK_RESPONSE_OK result? The "click" event is established when > I set up the button (i.e. with gtk_dialog_add_button). But the key > press is > established with g_signal_connect, which sends control to a handler. If > you're in > a loop checking the user input, you can't easily go off to a separate > handler. > > There must be a simple way of doing this, but I have yet to figure it out. See Gtk::Window::set_default(), together with Gtk::Entry::set_activates_default() and/or Gtk::Window::activate_default(). You may also want to consider Gtk::Window::set_focus() and Gtk::Widget::grab_focus(). Chris _______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list