[Mono-devel-list] Binding to Glade Combo

Leon Stringer leon.stringer at nhs.net
Wed Jul 7 11:05:58 EDT 2004


Hi,

I'm trying to develop a GUI app using Glade to develop the interface.
I've managed to bind to some GTK widgets (Button and TextView) but I get
an error when I try to bind to a Combo box (source code below):

(<unknown>:4787): Gtk-CRITICAL **: file gtktreemodel.c: line 998
(gtk_tree_model_get_iter_first): assertion `GTK_IS_TREE_MODEL
(tree_model)' failed
 
Unhandled Exception: System.ArgumentException: Object type cannot be
converted to target type.
Parameter name: val
in <0x000bd> System.Reflection.MonoField:SetValue
(object,object,System.Reflection.BindingFlags,System.Reflection.Binder,System.Globalization.CultureInfo)
in <0x001c6> Glade.XML:BindFields (object,System.Type)
in <0x0001a> Glade.XML:BindFields (object)
in <0x0001c> Glade.XML:Autoconnect (object)
in <0x00055> project1:.ctor ()
in <0x0001b> project1:Main (string[])

I created a GNOME project in Glade and am using Mono 1.0 on Fedora Core
2.

Any help gratefully received.

Leon...
---
project1.cs:
using System;
using Gtk;
using Glade;
                                                                                
public class project1 {
    [Glade.Widget]
    Gtk.Combo comboboxentry1;
                                                                                
    public static void Main(string[] args)
    {
        new project1();
    }
                                                                                
    public project1()
    {
        Application.Init();
        Glade.XML gxml = new Glade.XML ("project1.glade", "window1",
null);
        gxml.Autoconnect(this);
        Application.Run();
    }
}

project1.glade:
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
 
<glade-interface>
<requires lib="gnome"/>
 
<widget class="GtkWindow" id="window1">
  <property name="visible">True</property>
  <property name="title" translatable="yes">window1</property>
  <property name="type">GTK_WINDOW_TOPLEVEL</property>
  <property name="window_position">GTK_WIN_POS_NONE</property>
  <property name="modal">False</property>
  <property name="resizable">True</property>
  <property name="destroy_with_parent">False</property>
  <property name="decorated">True</property>
  <property name="skip_taskbar_hint">False</property>
  <property name="skip_pager_hint">False</property>
  <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
 
  <child>
    <widget class="GtkComboBoxEntry" id="comboboxentry1">
      <property name="visible">True</property>
    </widget>
  </child>
</widget>
 
</glade-interface>





More information about the Mono-devel-list mailing list