[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gtk-app-devel
Subject:    Re: key press in drawing area
From:       Havoc Pennington <rhp () zirx ! pair ! com>
Date:       1999-07-08 20:31:17
[Download RAW message or body]


On Thu, 8 Jul 1999, K. M. Hawarden-Ogata wrote:
> 
> Did all this and my drawing_area is receiving key press events. Thanks!
> But, I am using the arrow key to position something in my drawing
> area. The arrow keys moves the focus to the next widget. How can I prevent
> this?
> 

You have to connect a signal handler to key_press_event on the drawing
area using gtk_signal_connect_after(), and the handler has to return TRUE. 

Alternatively, create a new widget (perhaps a subclass of drawing area)
and return TRUE from its default key press handler.

If you read what my book's sample chapters have to say about signal
emission, then look at gtk_window_key_press_event() in gtkwindow.c, you'll
understand what's going on. (the arrow keys and other GtkWindow key
shortcuts only happen if the focus widget's event emission returns FALSE, 
i.e. the last signal handler to run for the drawing area must return TRUE)

Havoc



-- 
         To unsubscribe: mail gtk-app-devel-list-request@redhat.com with 
                       "unsubscribe" as the Subject.

	Mailing list concerns should be mailed to <listmaster@redhat.com>

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic