Re: [gtk-list] Re: toggle button
- From: Alexander Kotelnikov <sacha AK2614 spb edu>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: toggle button
- Date: Sun, 31 Jan 1999 00:50:06 +0300 (MSK)
On Sat, 30 Jan 1999, Owen Taylor wrote:
> Alexander Kotelnikov <sacha@AK2614.spb.edu> writes:
>
> > I use
> > gtk_toggle_button_set_active
> > function, it works, but after exiting I have:
> > Gtk-WARNING **: invalid cast from `GtkWindow' to `GtkToggleButton'
> >
> > Gtk-CRITICAL **: file gtktogglebutton.c: line 276
> > (gtk_toggle_button_set_active): assertion `GTK_IS_TOGGLE_BUTTON
> > (toggle_button)' failed.
> >
> > Do anybody know what's up?
>
> It looks like you're passing in a GtkWindow to
> gtk_toggle_button_set_active...
> Owen
I've got it :) but IT WORKS PROPERLY
>
> [ Without seeing your code, it is hard to say exactly
> why this is happening, but that's what the messages
> indicate ]
here are parts of my code:
GtkWidget *button, *loop_button;
...
loop_button = gtk_toggle_button_new_with_label("Loop");
gtk_table_attach_defaults(GTK_TABLE(table),
loop_button,
5,6,
2,3);
gtk_signal_connect (GTK_OBJECT (loop_button), "clicked",
GTK_SIGNAL_FUNC (loop), GTK_OBJECT (drawing_area));
gtk_widget_show (loop_button);
...
button = gtk_button_new_with_label("Quit");
gtk_table_attach_defaults(GTK_TABLE(table),
button,
9,10,
2,3);
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (quit), GTK_OBJECT(loop_button));
gtk_widget_show (button);
...
void quit(GtkObject *widget)
{
gtk_main_quit();
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget),FALSE);
}
explanations
I use 'button' many times, 'loop_button' only once. I need my program
exiting just after pressing "Quit" button, it works only if "Loop" button
is not toggled (I think that's because "loop" function have many things to
do:), so I want my Quit buton to untoggle loop_button ("loop" function
works while(GTK_TOGGLE_BUTTON (widget)->active)) and then I want to
gtk_main_quit BUT I had to swap this actions, 'cos another way I get many
Gtk/Gdk 'messages' after exiting.
Thanks,
_____
Alexander Kotelnikov
Saint-Petersburg, Russia
mailto:sacha@ak2614.spb.edu
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]