>I set it all up, but I'm realizing that I still
>don't have a way to grab it when the tab key has
>caused the widget to lose its focus and not
>any other time. I tried using a generic GdkEvent
>and casting it to GdkEventKey and grabbing the
>keyval, but it didn't work. Is there a way to
>test for that?

you need to handle key_press and key_release for the relevant
widget. if you see TAB/Left/Right/Up/Down etc. you can (1) know that
focus is about to change and/or (2) use gtk_signal_emit_stop_by_name()
to halt the signal emission and prevent focus from being shifted at
all.

sample code (in Gtk--, but it should be clear) that steals Left and
Right from the focus navigation system:

gint
ARDOUR_UI::recorder_key_release (GdkEventKey *ev)

{
        bool stopit = false;

        switch (ev->keyval) {
        case GDK_Left:
                stopit = true;
        case GDK_less:
                transport_stop (0);
                break;

        case GDK_Right:
                stopit = true;
        case GDK_greater:
                transport_stop (0);
                break;
        }

        if (stopit) {
                gtk_signal_emit_stop_by_name (GTK_OBJECT(transport_base.gtkobj()),
                                              "key-release-event");     
        }

        return TRUE;
}

--p (wishing we could turn off focus & focus navigation completely)

_______________________________________________
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list

Reply via email to