Re: key bindings - gtk2



On Tue, 16 Jul 2002, Padraig O'Briain wrote:

> handled or the toplevel is reached. If the keystroke has still not been
> handled the toplevel checks for key bindings.

Are you talking about the key bindings API now?

  http://developer.gnome.org/doc/API/2.0/gtk/gtk-bindings.html

Or are you just stating that the toplevel is the last to check when you 
move upwards from the focus widget.

> Within a widget the handling of the keystroke will call key-press-event
> handlers defined for that widget. These should, among other things, check for 
> key bindings defined for the widget.

Or probably this is using the key bindings API.

I think you explanation of the overall handling is very nice. Thanks a
lot. What I still don't understand is where (and how) the above API is
used.

What kind of objects is the above key bindings connected to. I wrote code
like this that changed my scrolled window to use the arrow to scroll
instead of ctrl-arrow:

    binding_set = gtk_binding_set_by_class 
                    (G_OBJECT_GET_CLASS(G_OBJECT(scroll)));

    gtk_binding_entry_add_signal
       (binding_set,
        GDK_Up,
        (GdkModifierType)0,			  
        "scroll_child",
        2,
	GTK_TYPE_SCROLL_TYPE, 
        GTK_SCROLL_STEP_BACKWARD,
	G_TYPE_BOOLEAN,
        FALSE);

And this seems to work fine. But this connects the binding to the scrolled
window class. Is this always so? What if I just want to change it for one
scrolled window.

I've also seen that key bindings have some sort of priority

http://developer.gnome.org/doc/API/2.0/gtk/gtk-standard-enumerations.html#GtkPathPriorityType

How does this mix in with starting at the focus widget and move out. What
if the parent widget have a binding of the same key with higher priority. 
Or is this just to resolve the binding for one widget (I guess it is).

> I have not said anything about accessibility (atk) as I do not see its relevance 
> to the topic. If you are further questions, I will try to help.

Well, I don't know anything about atk and have never used it. I just
thought that if I make my key bindings work in the intended way it will
probably be good for atk also. I just assumed atk might have been
involved.

-- 
/Dennis




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