g_signal_connect -- "button_press_event" vs. "pressed"



If I code a button like this (I'm using whatever version
of GTK it is that came with Fedora Core 5)...

	GtkWidget *B = gtk_button_new_with_label (Label);
	g_signal_connect (GTK_OBJECT (B), "button-press-event",
                G_CALLBACK (Happened), "HELLO");

and the callback is this...

	Happened (GtkWidget *W, gpointer Data) {
		g_print ("ButtonHappened...|%s|\n", (char *) Data);
	}

when Happened is executed, it doesn't 
print the data. That is, I get 
"ButtonHappened...||". But when I replace
the parameter "button-press-event" in the 
call to g_signal_connect with "pressed", 
on execution the printout is as desired, 
"ButtonHappened...|HELLO|". 

Now, "button-press-event" is in lists of 
event types such as you find in the 
GTK 2.0 tutorial at
http://www.gtk.org/tutorial/a2769.html
As for "pressed" -- I don't know where 
I got it. It must have come along with some
example I found in a newsgroup or on the Web.
I haven't been able to find an event-type 
list anywhere that contains it, so I 
can't solve the mystery of why I get 
what I want when I use that parameter, but 
not with the "legitimate" parameter.

--     
Charles Packer
http://cpacker.org/whatnews
mailboxATcpacker.org 


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