Re: FW: Dialog closing prematurely with response code of 0
- From: David Nečas (Yeti) <yeti physics muni cz>
- To: gtk-app-devel-list gnome org
- Subject: Re: FW: Dialog closing prematurely with response code of 0
- Date: Wed, 21 Mar 2007 22:46:30 +0100
On Wed, Mar 21, 2007 at 04:42:39PM -0400, Kevin Lambert wrote:
Does anybody have any ideas about this? It looks like the response from
gtk_dialog_response is being captured by dialogs that don't match the
GtkDialog pointer that was passed in.
Post some code. Evidently it works for everyone else.
Yeti
--
http://gwyddion.net/
==========================================================================
#include <gtk/gtk.h>
static gint
next_dialog(GtkWindow *parent,
gint level)
{
GtkWidget *dialog, *label;
gint response;
gchar *s;
level++;
s = g_strdup_printf("Dialog %d", level);
dialog = gtk_dialog_new_with_buttons(s, parent, GTK_DIALOG_MODAL,
GTK_STOCK_YES, GTK_RESPONSE_YES,
GTK_STOCK_NO, GTK_RESPONSE_NO,
NULL);
gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE);
gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_NO);
g_free(s);
s = g_strdup_printf("This is dialog level %d.\n"
"Do you want to go one level deeper?", level);
label = gtk_label_new(s);
gtk_misc_set_padding(GTK_MISC(label), 12, 12);
g_free(s);
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), label);
gtk_widget_show_all(dialog);
gtk_window_present(GTK_WINDOW(dialog));
do {
response = gtk_dialog_run(GTK_DIALOG(dialog));
if (response == GTK_RESPONSE_YES)
next_dialog(GTK_WINDOW(dialog), level);
} while (response == GTK_RESPONSE_YES);
gtk_widget_destroy(dialog);
return response;
}
int
main(int argc, char *argv[])
{
gtk_init(&argc, &argv);
next_dialog(NULL, 0);
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]