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








2009-04-16ï"Tristan Van Berkom" <tvb gnome org> ï
On Tue, Apr 14, 2009 at 10:46 AM, donglongchao <donglongchao 163 com> wrote:
[...]
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.

With libglade, if you specify an object... it is like reffering to prehistoric
gtk_signal_connect_object(), which swaps your instance/user-data arguments
free-of-charge, allowing for direct hooking up of function calls from
within Glade.

i.e. connect to button1 "clicked", specify "window1" as the object, and then
just put "gtk_widget_hide" as the callback... you just wrote a button that
closes the window without any code...

Yeah its a little awkard an unclear... just forget about it ;-)

Cheers,
            -Tristan

Hi.

Maybe you did not understand me.
I mean when I use the callback function with two para(GtkButton *checkbutton1,gpointer user_data),
there is no response when I click the button, no messagesialog is created .Because There is an assertion 
error when run function "gtk_toggle_button_get_active".So the programme can not run into the codes after this 
function.
The error is like this "(gtk_toggle_button_get_active): assertion `GTK_IS_TOGGLE_BUTTON
 (toggle_button)' failed".

But if I use the function with only one para(GtkButton *checkbutton1),and I do not send "&spinbutton1" as a 
user_data,
the program runs very good ,and the messagediaog "window" is created and showed correctly.No such assertion 
error.
I do not know why. When sending user_data,must we by our hands only?Using g_signal_connect(......) or 
something like that?
Can not use glade to achieve our goal?
Anyone help me?Thanks a lot.

Wish you happy.
Dong



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