Re: [gtkmm] focus to DialogWindow



Matthew Walton wrote:

Andreas B. Thun wrote:

Detlef, thanks for your reply.

Actually, I want to set the focus on a displayed Gtk::DialogWindow
which contains the button.
When the window pops up, it has no focus. I have to move the mouse
pointer in..


That is determined by your window manager and (should be) entirely out of the control of the application. Window managers are the things responsible for determining if new windows get the focus or not, and while one would normally expect them to, they don't always.

Sometimes the way the dialog window is created in gtkmm may cause the window not to have focus as well. In our application, we have a dialog created in the constructor of the main application window. This dialog is used to 'login' to the program.

The dialog is created and 'show'ed before the constructor finished, which resulted in the main application window having focus even though the dialog window was on top and modal. To fix this we caused the dialog window to be 'presented' as soon as the application became idle:

   //
   // The LOGIN WINDOW
   //
   login.show();
   login.set_transient_for(*this);  // Cause login window to be on top.
// Present the window on idle so that the login window will have focus and
   // not the application window.
   Glib::signal_idle ().
connect (SigC::bind_return (SigC::slot (login, &Gtk::Window::present),false));

Jeff


You might want to look at your window manager settings.

Oh, and in gtkmm the response ID for an OK button should really be Gtk::RESPONSE_OK, although I would expect the value is the same as GTK_RESPONSE_OK, so that might work.

_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list






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