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

List:       gtk-app-devel
Subject:    Re: Can A Drawable Canvas Receive Key Events?
From:       Mike Melanson <mike () multimedia ! cx>
Date:       2007-04-02 19:32:35
Message-ID: 46115A53.8030408 () multimedia ! cx
[Download RAW message or body]

Mike Melanson wrote:
> I found that when I put a big text widget inside the XEmbed'ed GtkPlug 
> container instead of a big drawable canvas, it was able to receive 
> focus. Digging into the GTK source code, I noticed that it calls 
> gtk_widget_grab_focus() when it receives a button press event. So I did 
> the same for my canvas widget when the user clicks in it, and it seems 
> to work. The widget retains focus until the user clicks outside of the 
> window.

I missed a crucial step here. You also need to specify that the 
ordinarily non-focusable widget can receive focus by setting its 
"can-focus" property:

   GTK_WIDGET_SET_FLAGS (GTK_WIDGET(my_widget), GTK_CAN_FOCUS);

-- 
	-Mike Melanson
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[prev in list] [next in list] [prev in thread] [next in thread] 

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