How do I send arguments with signals?
- From: Bawer Dagdeviren <chamele0n geocities com>
- To: gtk-list redhat com
- Subject: How do I send arguments with signals?
- Date: Fri, 04 Jul 1997 02:53:57 +0200
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.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]