Re: gtk_entry problem in a gtk_dialog

On Thu, 2005-06-30 at 14:00 +0200, Colossus wrote:

I have a gtk_dialog with a gtk_entry and a button. Before
clickink Ok the user must supply a filename in the gtk_entry.
The problem: if the user doesn't do this I have a gtk_message_dialog
appears with an error message but to give control again to the 
gtk_dialog ? The execution of the code goes on !! This is the code:

You need to call gtk_run_dialog() again.  Try something like this:

        done = FALSE;
        while (!done) {
                switch (gtk_dialog_run(dialog)) {
                case GTK_RESPONSE_OK:
                        if (data valid) {
                                /* do whatever */
                                done = TRUE;
                        } else {
                                /* complain */

                case GTK_RESPONSE_CANCEL:
                case GTK_RESPONSE_DELETE_EVENT:
                        /* do whatever */
                        done = TRUE;

Better yet, dont make the OK button sensitive until the user has entered
something into the filename field.



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