Telling a widget not to be in the focus chain



Hi!

I would like to tell a widget to not be part of Gtk's focus chain.  I
know there is gtk_container_set_focus_chain, however, I would like to
keep Gtk's default focus chain logic and just would like to have one or
two widgets not being part of it.  The widget could be a GtkButton,
GtkEntry, GtkTreeView or GtkTextView, or any other user interface
element.

I tried to unset the GTK_CAN_FOCUS flag.  This works nicely e.g. for
GtkButton (pressing tab jumps over the button) but when doing this on a
GtkEntry or GtkTextView it means that the widget also doesn't grab the
focus when clicking on it, thus no text input is possible any more.

I tried g_signal_connect(widget, "focus", G_CALLBACK(noFocus), NULL)
where the callback is defined as:

static gboolean noFocus(GtkWidget *widget)
{
    g_signal_stop_emission_by_name(widget, "focus");
    return FALSE;
}

This works well for GtkButtons and GtkEntries but has a small glitch
for GtkTextView and GtkTreeView.  There is no focus drawn but still the
focus is 'somehow on the widget'.  Pressing the tab key again then
moves on to the next widget.  Not perfect.

So, anybody has an idea what the correct way of leaving a widget out of
the focus chain is?



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



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