Re: How to send user_data into callback function by glade only?



å2009-04-11ï"Tadej BorovÅak" <tadeboro gmail com> åéï
2009/4/11 donglongchao <donglongchao 163 com>:
Hi all,
I have a question using glade(3.4.5).
In the "signal" tab,there is a item "user_data".I want to know how to fill and what to fill to send the 
data I filled into the callback function, without using gtk_signal_connect(......) or something like 
that,just and only use glade itself and glade_xml_signal_autoconnect().
I do not know if i should define the data before I fill and send it,and where should I define my data? 
global scope? statics
one?I even do not know if i could send data defined by myself.
Remember just and only use Âglade itself and glade_xml_signal_autoconnect().
It is a simple question ,but confused me several days,will any one help?Thanks.

Wish you happy.
Dong
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Hello.

You can only pass other objects created in glade via this field. You
cannot pass structs, integers ...


-- 
Tadej BorovÅak
tadeboro gmail com
tadej borovsak gmail com
Hi,

I fill the item with "&myspinbutton" and I connect "clicked" signal of a button to callback function like 
follows.

void on_checkbutton1_clicked(GtkButton *checkbutton1,gpointer user_data)
{
        gchar spin[10];
        GtkWidget * window;
        if (gtk_toggle_button_get_active(checkbutton1)) 
                {window=gtk_message_dialog_new(NULL,GTK_DIALOG_MODAL |\
                                                   GTK_DIALOG_DESTROY_WITH_PARENT,
                                                   GTK_MESSAGE_INFO,                                    
GTK_BUTTONS_OK_CANCEL,g_ascii_dtostr(spin,10,gtk_spin_button_get_value((GtkSpinButton*)(user_data))));
        g_signal_connect(window,"response",
                                               gtk_widget_destroy,NULL);
        gtk_widget_show (window);}
}
And I want to show the value of "myspinbutton" by pass its point to callback function.But every time I click 
the button there is no response.Just left "(gtk_toggle_button_get_active): assertion `GTK_IS_TOGGLE_BUTTON
(toggle_button)' failed".

But if i do not pass the "&spinbutton", and the function only have one para(GtkButton *checkbutton1), it 
works,no error,no warning.

I do not know why.Any one could help?Thanks.

Wish you happy.
Dong



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