[Glade-users] Help with dialog box



I find the easiest way to run a dialog you've created in glade is to use 
the gtk_dialog_run just like any other dialog. Check out my example at 
http://gtkforums.com/viewtopic.php?t=53 which uses the font and color 
dialogs in glade. If you create your own dialog in glade, be sure to 
assign action enums to any non-stock buttons you add to the action area 
so that you can check which button was pressed.

- Micah Carrick
  http://www.micahcarrick.com | http://www.gtkforums.com

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
_______________________________________________
Glade-users maillist  -  Glade-users at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/glade-users

  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/glade-users/attachments/20070104/dde61314/attachment.html 




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