Re: Grab focus problems




Brad Pepers <brad@linuxcanada.com> writes:

> I've noticed when using gtk_widget_grab_focus in signal callbacks
> and such, it often doesn't seem to work right.  If changing focus
> to an entry widget, it gets highlighted like its got the keyboard
> focus but no key presses work until I click in the widget.  I've
> found that to work around this I need to use an idle callback and
> do the focus grab in there instead.
> 
> I've assumed in my head that the problem is that the grab_focus
> routine does some work immediately that other work queued up via
> idle callbacks later messes up.  No idea if this is really the
> problem or not but it would make sense to me.  I've had to work
> around similar problems in Java and had to do so in the same way.
> 
> Is this a known problem?  If it is, why doesn't the grab_focus
> routine itself do its work via an idle callback?

I don't think grab_focus is doing anything unusual. My
best guess is that the something that is happening in response
to the signal you are calling is screwing up GTK+'s internal
state.

What signal are you calling grab_focus from? Do you have
code that reproduce the problem?

Regards,
                                        Owen



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