Re: [GtkGLExt] keyboard focus



On Sun, 2014-02-16 at 23:27 -0800, Norman Goldstein wrote:
My window only receives keyboard events after I click in the window.
How can I programmatically set the window to have keyboard focus at startup?
My window inherits directly from FXMainWindow.

I have tried setFocu() and enable(), and have also overriden the 
canFocus() virtual method to return true, but all to no avail.

What do you mean by "window" ?

If you are talking about the toplevel window of your application, this
is technically not your decision to make - the window manager will
make the choice for you and activate/focus your application window
when the window manager decides it's a good idea.

You can on the other hand use gtk_widget_grab_focus() to set the
"focus widget" of your toplevel application window (for instance
perhaps the GtkWidget which has a GL enabled GdkWindow ?). This
will not cause your toplevel window to obtain focus, but should
ensure that the widget you chose has focus as soon as a user
enters your application.

Cheers,
    -Tristan




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