Re: Setting a default control in a windows



Murray Cumming wrote:
On Mon, 2005-03-14 at 08:46 -0600, Bob Caryl wrote:
Hello All,

Gonna try this question again:

I am trying to set a button in my window to be the "default" widget, i.e. this buttons "on_clicked" connected function will be executed when the enter key is pressed when this window has focus.
The code I'm using is as follows:

  default_button->set_flags(Gtk::CAN_DEFAULT);
  default_button->grab_default();
  this->activate_default();

I think you want to use Gtk::Window::set_default(). Maybe you are
confusing that with activate_default().

This is easier with libglademm.

Hey Murray,

I tried activate_default to no avail. The application has three Gtk::Entry objects. When run, the window appears with one of these Gtk::Entry objects having focus. Perhaps there is something I should to in relation with the Gtk::Entry object? Perhaps it needs to signal the window that the enter key has been pressed?

Thanks,

Bob Caryl



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