[Gtk-sharp-list] Using a Dialog box defined with glade with an Gtk.Dialog herited class

Gilles Fabio gilles.fabio at gmail.com
Wed Nov 15 11:29:28 EST 2006


Hello there,

Yep, I also try and I think mlgs is right. So, specify the name as in
your gui.glade file. Probably, it's not "mydialog".

public class MyDialog : Gtk.Dialog {
 
    public MyDialog() : base()
    {
        Glade.XML gxml = new Glade.XML(null, "gui.glade", "dialog_something", null);
        gxml.Autoconnect(this);
    }
}

dialog_something must be the name of the root widget.

Don't worry about your English! It is pretty well :) Nice to see french
people on this mailing list :)

Cheers,
Gilles

> > Hello
> > I should like use a dialog box defined with Glade in a mono application.
> > For the moment I'm trying to do it on this way but I didn't succeed : 
> > First I've defined this class:
> > 
> > public class mydialog : Gtk.Dialog
> > {
> >   public mydialog() : base()
> >   {
> >     Glade.XML gxml = new Glade.XMl(null,"gui.glade",mydialog,null);
> >     gxml.autoconnect(this);
> >   }
> > }
> > 
> 
> Look at this it might help you, you are specifying class instead of name
> as it was defined in glade.
> 
> Instead of mydialog specify Name as in your gui.glade file (as string).
> 
> 
> Copy/Paste from help
> ====================
> 
> Creates an XML object from an System.Reflection.Assembly
> 
> public XML (System.Reflection.Assembly assembly, string resource_name,
> string root, string domain)
> 
> Parameters
>         assembly
>         an System.Reflection.Assembly, or null to use the current
>         assembly 
>         
>         resource_name
>         the name of the resource in assembly
>         
>         root
>         the widget node to start building from, or null.
>         
>         domain
>         the translation domain for the XML file (null is the default)
> 
> > In order to use this dialogbox I'm using this code : 
> > 
> > mydialog  dgl = new mydialog();
> > int result = mydialog.Run()
> > if (result==(int)ResponseType.Ok)
> > {//traitement if OK}
> > dlg.destroy();
> > 
> > When I'm using this I have a dialog box but it is empty 
> > 
> > Someone has an idea about my mistake or about another way to obtain
> > same result?
> > 
> > PS : Sorry for my bad English I'm french and don't speak English very
> > often :-)

-- 
Gilles Fabio aka "Play"

Weblog    : http://gilles.fabio.free.fr/blog
OpenPGP   : 320F31F8 (pgp.mit.edu)
Sent from : SUSE Linux Enterprise Desktop 10



More information about the Gtk-sharp-list mailing list