[gtk-list] EventBox's problem



Hello,
        When using gtk_signal_connect() on the EventBox widget, the data does
 not get passed to the callback function. Here's the test codes. Any help will b
e much appreciated. Thanks!

#include <gtk/gtk.h>

void callback(GtkWidget *widget,gpointer *data)
{
        g_print("%s\n",data);
}

int main(int argc,char *argv[])
{
        GtkWidget *window;
        GtkWidget *event_box;
        GtkWidget *label;

        gtk_init(&argc,&argv);

        window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
        gtk_signal_connect(GTK_OBJECT(window),"delete_event",
                           GTK_SIGNAL_FUNC(gtk_main_quit),NULL);

        event_box = gtk_event_box_new();
        gtk_widget_set_events (event_box, GDK_BUTTON_PRESS_MASK);
        gtk_signal_connect(GTK_OBJECT(event_box),"button_press_event",
                           GTK_SIGNAL_FUNC(callback),(gpointer)"TEST");
	gtk_container_add(GTK_CONTAINER(window),event_box);
        gtk_widget_show(event_box);

        label = gtk_label_new("event_box");
        gtk_container_add(GTK_CONTAINER(event_box),label);
        gtk_widget_show(label);

        gtk_widget_show(window);

        gtk_main();
        
        return 0;
}
						Regards,
						  htn



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