Hello,

  I have tested the Mono Handbook example for glade. It works fine, but
after adding a combo field and reading the text of it, I got an
exception. I don't know if it is a bug or my mistake. The code is
attached with the email.

The exception after clicking the button:
=======================================================================
Unhandled Exception: System.NullReferenceException: Object reference not
set to an instance of an object
in [0x0000b] (at /home/chris/devel/Mono/gDVBszap/Main.cs:94)
GladeSamples.GladeTest:on_button1_clicked (object,System.EventArgs)
in <0x0006a> (wrapper delegate-invoke)
System.MulticastDelegate:invoke_void_object_EventArgs
(object,System.EventArgs)
in <0x00120> GtkSharp.voidObjectSignal:voidObjectCallback (intptr,int)
in <0x00055> (wrapper native-to-managed)
GtkSharp.voidObjectSignal:voidObjectCallback (intptr,int)
in (unmanaged) (wrapper managed-to-native) Gtk.Application:gtk_main ()
in <0x00004> (wrapper managed-to-native) Gtk.Application:gtk_main ()
in <0x00007> Gtk.Application:Run ()
in [0x00023] (at /home/chris/devel/Mono/gDVBszap/Main.cs:87)
GladeSamples.GladeTest:.ctor (string[])
in [0x00001] (at /home/chris/devel/Mono/gDVBszap/Main.cs:74)
GladeSamples.GladeTest:Main (string[])
=======================================================================

Thanks
Christoph
namespace GladeSamples {
        using System;
        using Gtk;
        using Glade;
        using GtkSharp;

        public class GladeTest
        {
                public static void Main (string[] args)
                {
                        new GladeTest(args);
                }
 
                [Glade.Widget]      
                Button button1;
                Combo combo1;

                public GladeTest (string[] args) 
                {
                        Application.Init();

                        Glade.XML gxml = new Glade.XML ("gdvbszap.glade", "window1", null);
                        gxml.Autoconnect (this);             

                        Application.Run();
                }              
    
                public void on_button1_clicked (System.Object obj, EventArgs e) 
                {
                        Console.WriteLine (combo1.Entry.Text);
                }
        }
}

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil

Reply via email to