[423] in The GTK GIMP ToolKit mailing list archive

home help back first fref pref prev next nref lref last post

[gtk-list] How do I send arguments with signals?

daemon@ATHENA.MIT.EDU (Bawer Dagdeviren)
Thu Jul 3 20:39:37 1997

Date: Fri, 04 Jul 1997 02:53:57 +0200
From: Bawer Dagdeviren <chamele0n@geocities.com>
To: gtk-list@redhat.com
Resent-From: gtk-list@redhat.com
Reply-To: gtk-list@redhat.com

Hi, I have a question about sending arguments to signal functions.
The following code snippet shows what I WANT to do, but have not been
able to do:

#include <gtk/gtk.h>

void hello (GtkWidget *label)
{
	gtk_set_label (GTK_LABEL (label), "Hello world");
}

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

/* Here goes some code */

	gtk_signal_connect (GTK_OBJECT (button), "clicked",
			     (GtkSignalFunc) hello, label);
/*						     ^^^^
		What should I put here if not this? __^^^		 	
*/
/*Some more code */
return 0;
}	 

The problem is this: I can't seem to alter the caption of the label. Am
I doing something weird with the pointers? I tried this block of code
(well not really THIS block of code :-) ) but I get an error that speak
of some conversion error between a Button and Label, so I changed
hello() to:
void hello(GtkWidget *button, GtkWidget *label).... 
assuming that somehow the signal sends the button-object as an argument.
I really think I'm out in the dark here, I take full responsibility for
all the stupidity contained within this text :-)

Looking forward to your answers:

Bawer Dagdeviren.

--
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null


home help back first fref pref prev next nref lref last post