Re: focus, and intercepting arrow keys
- From: muppet <scott asofyet org>
- To: Jeff 'japhy' Pinyan <japhy perlmonk org>
- Cc: GTK-Perl Mailing List <gtk-perl-list gnome org>
- Subject: Re: focus, and intercepting arrow keys
- Date: Tue, 22 Mar 2005 20:42:52 -0500
On Mar 22, 2005, at 4:40 PM, Jeff 'japhy' Pinyan wrote:
I have Notebook and Button widgets, but I'd really like to intercept
the pressing of arrow keys and have them affect an entirely different
widget. Where should I set up the signal handler, and how can I
prevent the arrow keys from "falling through" my key_press handler to
the other widgets?
not exactly sure what the "correct" way to do it is (probably something
involving accelerator groups or keybindings), but here's what i've
done:
- declare public functions on my image display widget to do zooming
scrolling.
- connect to the key-press-event of the toplevel window in which the
widget is packed
- in that handler, call the appropriate functions on the widget in
response to the arrow keys and +/- keys.
- if i handled the event, return TRUE to stop event propagation.
otherwise, return FALSE to let the default handling occur.
arguably, a more correct way to do it would've been to make the widget
itself focusable, and then set up the key handling only in that widget,
but i had trouble with that (and it was long ago so i don't remember
why).
--
How come hair colors for women take an hour, but "wash out the gray"
stuff for men only five minutes? This is so unfair!
-- Elysse, complaining about commercials
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]