[Glade-users] Help with dialog box



Michael Ekstrand wrote:
Paolo:

Please keep replies on-list, for the benefit of search engines, other 
readers, etc.; I'm CC'ing this back to the list.

On Jan 4, 2007, at 11:12 AM, Paolo Franzetti wrote:
Hello

My code is very simple. I have this function:


void on_button_pressed() {

   dialog=glade_xml_new(/mydir/dialog.glade" , NULL, NULL);
   glade_xml_signal_autoconnect(dialog);

}


which is called on a button press in my main window.

When I press the button I see the dialog, but it is completely
stuck; I cannot do anything in it (press button, open the combo box
list, close the dialog).

Then I'm not sure what's going on; the problem is likely somewhere else 
in your code.  Perhaps something else is currently active as a modal 
dialog?  If this new dialog is shown in response to a button in a modal 
dialog, it won't respond to anything unless it's set up to be modal (and 
it may need to be a transient child of the first dialog - see 
gtk_window_set_transient_for).  The following program works perfectly 
with your glade file on my system:

==== BEGIN SNIP ====
#include <gtk/gtk.h>
#include <glade/glade-xml.h>

int main(int argc, char *argv[])
{
    gtk_init(&argc, &argv);

    GladeXML *dlg = glade_xml_new("dialog.glade", NULL, NULL);
    glade_xml_signal_autoconnect(dlg);

    gtk_main();
    return 0;
}

void on_about_cancel_clicked(GtkButton *button)
{
    gtk_main_quit();
}
==== END SNIP ====

- Michael


I have found the problem; the main window was set up to be modal.

Now it works.

Thank you very much,
Paolo






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