Re: Can A Drawable Canvas Receive Key Events?
- From: Mike Melanson <mike multimedia cx>
- To: gtk-app-devel-list gnome org
- Subject: Re: Can A Drawable Canvas Receive Key Events?
- Date: Mon, 02 Apr 2007 12:32:35 -0700
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]