Re: gtk_dialog_run and right way to show dialog

On Mon, 2005-01-03 at 23:21 +0300, Jan wrote:

For show dialog I use gtk_dialog_run. Is it right?

Personally, I always try to avoid using gtk_dialog_run() because you
block on it.  

I have to say, that in my dialog I have two buttons:
close and help.

So when I show dialog using gtk_dialog_run and user
push help button gtk_dialog_run return. Logicaly it is not right,
because of I want after push help button stay dialog as it is, and show

As I understand it, gtk_dialog_run() blocks until a response is received
(one of the buttons is clicked or the window is closed).  

Clicking Help is a response, and without returning you would not know it
had been clicked (especially when blocking).

Is any way to tell gtk_dialog_run return control to me, only if
user push close button or click on close button in window
system menu?

You could set up a callback and run the dialog without blocking:
        g_signal_connect_swapped (dialog, "response",
                                  G_CALLBACK (response_cb), 
        gtk_widget_show_all (dialog);

then set up a handler for the response:

        void response_cb (GtkDialog *dialog,
                          gint response,
                          gpointer user_data)
                if (response == GTK_RESPONSE_HELP) {
                        /* do some code */
hope this helps, for more information see the online documentation about
gtk_dialog_run() and other dialog API:


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