Re: Connecting to key-up events as accelerators
- From: Owen Taylor <otaylor redhat com>
- To: gtk-devel-list redhat com
- Subject: Re: Connecting to key-up events as accelerators
- Date: 26 Jan 2000 21:24:48 -0500
David Benson <daveb@idealab.com> writes:
> I wish to trap the key down and key up events
> and emit signals for each of them. (I'll be timing the
> interval primarily but I may want a visual cue on press...)
>
> I'm not sure if this is possible... might there be a simple
> hack to achieve the effect w/o reinventing too much
> of the gtkaccelerator stuff?
>
> You see, it would be nice to easily remap keys/have
> multiple instances of these widgets, so I think I can benefit
> from that system...
If you want to set up key bindings on individual widgets,
you want the binding mechanism, not the accelerator mechanism.
Accelerators map:
Keystroke on toplevel => signal on particular widget, with
no arguments
Bindings Map:
Keystroke on widget => sequence of signals, possibly with
arguments, on the same widget.
And, as it turns out, the binding mechanism does allow you
to do things on key release events. You simply add in
the GDK_RELEASE_MASK into the modifier mask for the
binding key you are setting up.
The GtkCList widget is one widget that does that.
Now, I tend to think that allowing bindings on key release events
was not a very good idea - it means unless all the bindings
are carefully synchronized you'll probably get cases where
your widget ends up in an inconsistent state.
But we did add the feature, and it is possible.
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]