Passing values to functions
- From: Shiraz Baig <shiraz_baig yahoo com>
- To: gtk-list gnome org
- Subject: Passing values to functions
- Date: Mon, 28 Jan 2002 22:58:59 -0800 (PST)
To List:
I am a newbie. Can anyone tell me, in the following
elementary program, why doesn't the function "hello"
that it has not been passed any data. Because in
gtk-signal-connect, we are passing NULL data.
Wherefrom is this data coming. In another case, I have
seen drawing_area being passed like this. How does it
get to the function "hello".
Thanks.
bye.
#include <gtk/gtk.h>
void hello( GtkWidget *widget,
gpointer data )
{
g_print ("Hello World\n");
}
void destroy( GtkWidget *widget,
gpointer data )
{
gtk_main_quit();
}
int main( int argc,
char *argv[] )
{
GtkWidget *window;
GtkWidget *button;
gtk_init(&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_signal_connect (GTK_OBJECT (window),
"destroy",
GTK_SIGNAL_FUNC (destroy),
NULL);
button = gtk_button_new_with_label ("Hello
World");
gtk_signal_connect (GTK_OBJECT (button),
"clicked",
GTK_SIGNAL_FUNC (hello),
NULL);
gtk_container_add (GTK_CONTAINER (window),
button);
gtk_widget_show (button);
gtk_widget_show (window);
gtk_main ();
return(0);
}
__________________________________________________
Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions!
http://auctions.yahoo.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]