[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Wanna catch a motion event
- From: Andreas Sliwka <goff nef wh uni-dortmund de>
- To: gtklist <gtk-app-devel-list redhat com>
- Subject: Wanna catch a motion event
- Date: Sat, 5 Feb 2000 21:37:43 +0100
Hi,
Id like to let the user pick out on of 18 specified rectangels in a pixmap.
So I display a window, put a GtkPixmap in it and connect a callback to the
motion_notify_event. But that did not work. So I created a event box, put the
pixmap in it and connected the eventobox to the event. Now it works. As long
as I press a mouse button. How can I accomplish it that my callback gets
called even if no mouse button is pressed ?
please have a look at the code snippet and show me where I´m wrong.
------------------- Code --------------------
eventbox=gtk_event_box_new();
small_bricks=gdk_pixmap_create_from_xpm (window->window, NULL,
&style->bg[GTK_STATE_NORMAL],
"small_bricks.xpm");
small_bricks_widget=gtk_pixmap_new(small_bricks,NULL);
gtk_container_add(GTK_CONTAINER(window),eventbox);
gtk_container_add(GTK_CONTAINER(eventbox),small_bricks_widget);
gtk_widget_show(small_bricks_widget);
gtk_signal_connect(GTK_OBJECT(eventbox),"motion_notify_event",
GTK_SIGNAL_FUNC(small_bricks_motion ),NULL);
g_print("before\n");
gtk_widget_set_events (eventbox, GDK_POINTER_MOTION_MASK
| GDK_POINTER_MOTION_HINT_MASK);
g_print("after\n");
------------------- Code --------------------
produces the following output:
before
Gtk-CRITICAL **: file gtkwidget.c: line 3827 (gtk_widget_set_events): assertion `!GTK_WIDGET_REALIZED (widget)' failed.
after
What did I do wrong ?
mfg
--
Andreas Sliwka | goff@nef.wh.uni-dortmund.de | ICQ goff:13961062
------BEGIN GEEK CODE BLOCK-----
GCS/MU/L d-(+) S:++ a- C++$ UL++$ P++$ L+++$ E--- W+$ N++ o-- K- w-- O- !M !V
PS+(++) PE Y+ PGP>++ t(+) 5+ X- R tv+ b+++ DI++ D G e+ h- r++ x+++
-------END GEEK CODE BLOCK------
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]