pointers mixed?



Hello.

This is my second time :)

I have just started to program with gtk something more serious than a button wich prints "Hello Wolrd".

I am using glade because of its easier design of UI. I need to read the contents of a bunch of widgets with the click of one button. I dont know how to do it ye, but i wanted to start reading the content of a text box, this is what happened. this is the output from the glade program.


this is from interfaces.c:

gtk_signal_connect_object (GTK_OBJECT (button2), "clicked",
                             GTK_SIGNAL_FUNC (on_button2_clicked),
                             GTK_OBJECT (text1));


And this is the function:

on_button2_clicked                     (GtkButton       *button, gpointer         user_data)
{

gchar *texto;

texto=gtk_editable_get_chars(GTK_EDITABLE(button),  0, -1);
printf("%s\n",texto);
g_free(texto);
}

The weird thing is "This works!".
whereas if i used "user_data" instead of "button", when i run the compiled binary i get an error message saying me i couldnt convert a button widget into a Text one if i did GTK_IS_EDITABLE, or that GTK_IS_EDITABLE failed.

What can be going on here? I use glibc 2, but i dont think thats the problem...

Any Idea would be appreciated.

Thank you.

-- 
ICQ: 15605359 Bicho
                                  =^..^=
First, they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Gandhi.
........Por que no pensaran los hombres como los animales? Pink Panther........
-------------------------------気検体の一致------------------------------------
暑さ寒さも彼岸まで。
アン アン アン とっても大好き





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