signal/slot question
- From: Robert Wilhelm <robert physiol med tu-muenchen de>
- To: gtk-list redhat com
- Subject: signal/slot question
- Date: Tue, 3 Mar 1998 18:23:46 +0100
Doing a gtk_signal_connect(), the data (last argument) does not reach
the callback function.
What I am doing wrong here?
Robert
#include <gtk/gtk.h>
static void cb(GtkWidget* widget, gpointer data)
{
printf("cb %p %p %p\n",widget,data, *(void **) data);
}
int main (int argc, char *argv[])
{
GtkWidget *window;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_events(window, GDK_BUTTON_PRESS_MASK| GDK_BUTTON_RELEASE_MASK );
gtk_signal_connect(GTK_OBJECT(window),"button_press_event",GTK_SIGNAL_FUNC(cb),window);
gtk_signal_connect(GTK_OBJECT(window),"button_release_event",GTK_SIGNAL_FUNC(cb),NULL);
gtk_widget_show(window);
gtk_main ();
return 0;
}
$./a.out
cb 0x8065620 0x806d090 0x4
cb 0x8065620 0x806d090 0x7
cb 0x8065620 0x806d090 0x4
cb 0x8065620 0x806d090 0x7
cb 0x8065620 0x806d090 0x4
cb 0x8065620 0x806d090 0x7
cb 0x8065620 0x806d090 0x4
cb 0x8065620 0x806d090 0x7
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]