[maemo-developers] C - GTK - Dialog Box - I never get the result

From: Tapani Pälli tapani.palli at nokia.com
Date: Wed Jan 30 08:13:41 EET 2008
Hello;

ext David Hautbois wrote:
> Hi
>
> I'm playing with C and GTK.
> I have a problem to get the result of a dialogbox.
>
> The code :
> ****************************************************************
> GtkWidget* pBoite;
>     GtkWidget* pEntry;
>
>     pBoite = gtk_dialog_new_with_buttons("Saisie du nom",
>         GTK_WINDOW(main_window),
>         GTK_DIALOG_MODAL,
>         GTK_STOCK_OK,GTK_RESPONSE_OK,
>         GTK_STOCK_CANCEL,GTK_RESPONSE_CANCEL,
>         NULL);
>
>     pEntry = gtk_entry_new();
>     gtk_entry_set_text(GTK_ENTRY(pEntry), "Enter your name");
>     gtk_box_pack_start(GTK_BOX(GTK_DIALOG(pBoite)->vbox), pEntry, TRUE, 
> FALSE, 0);
>
>     gtk_widget_show_all(GTK_DIALOG(pBoite)->vbox);
>
>     switch (gtk_dialog_run(GTK_DIALOG(pBoite)))
>     {
>         case GTK_RESPONSE_OK:
>             printf("ok");
>             break;
>         case GTK_RESPONSE_CANCEL:
>             printf("cancel");
>         case GTK_RESPONSE_NONE:
>         default:
>             printf("none");
>             break;
>     }
>     gtk_widget_destroy(pBoite);
> ********************************************************************
>
> It's very simple.
> But, when I validate the dialogbox, I never get GTK_RESPONSE_OK, 
> GTK_RESPONSE_CANCEL, GTK_RESPONSE_NONE.
>
>   

Check if you're getting GTK_RESPONSE_ACCEPT or GTK_RESPONSE_REJECT instead.

> At the beginning, I used Glade, and had the same problem.
>
> I don't have tested it on my pc yet....
>
>
> Any idea ?
>
> Thanks.
>
> David.
>
>   


// Tapani Pälli

-- 
Software Engineer
Open Source Software Operations 


More information about the maemo-developers mailing list