GTK2: Problems with key events
- From: Fabio Rotondo <mlists rotondo it>
- To: gtk-devel <gtk-app-devel-list gnome org>
- Subject: GTK2: Problems with key events
- Date: Sun, 13 Oct 2002 19:26:08 +0200
Hi,
I am playing with key events in GTK2, but the source code I have
attatched
does not trig the "key-release" event. What's wrong?
I am using GTK+2 2.03
--
Ciao,
Fabio
----------------------------------------------------------
NOLUG: http://www.rotondo.it/nolug/
Advanced Foundation Classes: http://afc.sf.net
Reqtools - The Requester Library: http://reqtools.sf.net
MAME Visual Guide: http://www.rotondo.it/~fabio/mamevg/
----------------------------------------------------------
Registered Linux User #264499 - http://counter.li.org
#include <gtk/gtk.h>
void key_press_win ( GtkWidget * w, GdkEventKey * key, gpointer data )
{
printf ( "WIN Key Press\n" );
}
void key_release_win ( GtkWidget * w, GdkEventKey * key, gpointer data )
{
printf ( "WIN Key Release\n" );
}
void mk_gui ()
{
GtkWidget * win;
GtkWidget * clist;
static char * titles [] = { "Hello", "World" };
win = gtk_window_new ( GTK_WINDOW_TOPLEVEL );
clist = gtk_clist_new_with_titles ( 2, & titles );
gtk_container_add ( GTK_CONTAINER ( win ), clist );
gtk_widget_add_events ( clist, GDK_KEY_RELEASE_MASK | GDK_KEY_PRESS_MASK );
gtk_signal_connect ( GTK_OBJECT ( win ), "key-press-event", (GtkSignalFunc) key_press_win, NULL );
gtk_signal_connect ( GTK_OBJECT ( win ), "key-release-event", (GtkSignalFunc) key_release_win, NULL );
gtk_widget_show_all ( win );
}
int main ()
{
gtk_init ( NULL, NULL );
mk_gui ();
gtk_main ();
return ( 0 );
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]