Re: [gtk-list] Remaining Q's



>  The one big thing that I can't figure out now that's impeding my work
>  is how can I make a preview capture all the keyboard events. I need to be
>  able to do it in isolation (as in "b" has been pressed) and in conjunction
>  with mouse clicks (Ctrl and Space were both down when the mouse button was
>  pressed down). Where can I find this info? (Some keywords will suffice!)

You need to make sure that

	1. The preview's window can get key press/release events.  You
           can use this code:

		GtkWidget *preview;

		preview = gtk_preview_new (GTK_PREVIEW_COLOR);
		gtk_widget_set_events (preview, 
				       (gtk_widget_get_events (preview)
					| GDK_KEY_PRESS_MASK
					| GDK_KEY_RELEASE_MASK));

	2. The preview can grab the focus:

		GTK_WIDGET_SET_FLAGS (preview, GTK_CAN_FOCUS);

	3. The preview gets the focus at some point:

		gtk_widget_grab_focus (preview);

Good luck,

  Federico



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]