Re: destroying a dialog



On Sat, 07 Oct 2000 10:45:55 -0700, Greg Martin said:

I'm brand new to gtk and love it so far. I'm experiencing what seems
 like strange behavior from gtk_widget_destroy. I'm using windowmaker on
 Red Hat and egcs. Below are the significant lines. When the
 cancel_button is pressed the button itself disappears and not the
 dialog.
 
 dialog = gtk_dialog_new();
 
 cancel_button = gtk_button_new_with_label("Cancel");
      
 gtk_signal_connect(GTK_OBJECT(cancel_button), "clicked",
                      GTK_SIGNAL_FUNC(gtk_widget_destroy), dialog);
 
 gtk_container_add (GTK_CONTAINER(GTK_DIALOG(dialog)->action_area),
                              cancel_button);

the signal_connect passes the button first, so you are destroying the button
NOT the dialog, the correct way to do this would be

gtk_signal_connect(GTK_OBJECT(cance_button), "clicked",
GTK_SIGNAL_FUNC(cancel_clicked_cb), dialog);

void cancel_clicked_cb(GtkWidget *button, GtkWidget *dialog)
{
        gtk_widget_destroy(dialog);
        return;
}



 -- 
 Regards,
 Greg Martin
 gregm netidea com
 
 _______________________________________________
 gtk-app-devel-list mailing list
 gtk-app-devel-list gnome org
 http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
 

-- 
muhri muhri net -- http://www.muhri.net






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