[Gtk-sharp-list] TreeView trouble

Jorge De Gante jdegante@linuxware.com.mx
21 Feb 2003 17:46:18 -0600


Hi there


I'm trying to make this program work, I enterrly based on gtk and
gtksharp api documents, but a I think you guys can show how to do it
right.

this is the source
---------------------------------------------------

using Gtk;
using Gdk;
using GLib;
using Gnome;
using Glade;
using GtkSharp;
using System;



public class prueba{

        private Entry ent_nombre;
        private ListStore model;
        private TreeIter iter;
        private CellRendererText renderer;
        private TreeViewColumn nombre;
        private TreeViewColumn valor;

        public static int Main(string[] args)
        {
                new prueba(args);
                return 0;
        }

        public prueba(string[] args)
        {
                Application.Init();
                Glade.XML gxml =3D new Glade.XML ("monedas.glade",
"win_catalogo", null);
                gxml.Autoconnect (this);
                model =3D new ListStore(2, TYPE_STRING, TYPE_STRING);
                iter =3D new TreeIter();
                model.Append(iter);
                model.SetValue(iter,1,"Moneda 1");
                model.SetValue(iter,2,"Valor 1");
                renderer =3D new CellRendererText();
                nombre =3D new TreeViewColumn();
                nombre.AddAttribute(renderer, "text", 1);
                valor =3D new TreeViewColumn();
                valor.AddAttribute(renderer, "text", 2);
                TreeView tree_monedas =3D (Gtk.TreeView)
gxml["tree_monedas"];
                treee_monedas.Add(model);
                tree_monedas.AppendColumn(nombre);
                tree_monedas.AppendColumn(valor);
                Application.Run();

        }

        public void on_win_catalogo_delete_event(object o,
DeleteEventArgs args)
        {
                Application.Quit();
                args.RetVal =3D true;
        }



}


--------------------------------------------

this is the glade xml

---------------------------------------------

<?xml version=3D"1.0" standalone=3D"no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">

<glade-interface>

<widget class=3D"GtkWindow" id=3D"win_catalogo">
  <property name=3D"visible">True</property>
  <property name=3D"title" translatable=3D"yes">Cat=C3=A1logo de
Monedas</property>
  <property name=3D"type">GTK_WINDOW_TOPLEVEL</property>
  <property name=3D"window_position">GTK_WIN_POS_NONE</property>
  <property name=3D"modal">False</property>
  <property name=3D"resizable">True</property>
  <property name=3D"destroy_with_parent">False</property>
  <signal name=3D"delete_event" handler=3D"on_win_catalogo_delete_event"
last_modification_time=3D"Fri, 21 Feb 2003 20:26:10 GMT"/>

  <child>
    <widget class=3D"GtkVBox" id=3D"vbox1">
      <property name=3D"visible">True</property>
      <property name=3D"homogeneous">False</property>
      <property name=3D"spacing">0</property>

      <child>
        <widget class=3D"GtkLabel" id=3D"label1">
          <property name=3D"visible">True</property>
          <property name=3D"label" translatable=3D"yes">Cat=C3=A1logo de
Monedas</property>
          <property name=3D"use_underline">False</property>
          <property name=3D"use_markup">False</property>
          <property name=3D"justify">GTK_JUSTIFY_LEFT</property>
          <property name=3D"wrap">False</property>
          <property name=3D"selectable">False</property>
          <property name=3D"xalign">0.5</property>
          <property name=3D"yalign">0.5</property>
          <property name=3D"xpad">0</property>
          <property name=3D"ypad">0</property>
        </widget>
        <packing>
          <property name=3D"padding">0</property>
          <property name=3D"expand">False</property>
          <property name=3D"fill">False</property>
        </packing>
      </child>

      <child>
        <widget class=3D"GtkScrolledWindow" id=3D"scrolledwindow1">
          <property name=3D"visible">True</property>
          <property name=3D"can_focus">True</property>
          <property
name=3D"hscrollbar_policy">GTK_POLICY_ALWAYS</property>
          <property
name=3D"vscrollbar_policy">GTK_POLICY_ALWAYS</property>
          <property name=3D"shadow_type">GTK_SHADOW_NONE</property>
          <property
name=3D"window_placement">GTK_CORNER_TOP_LEFT</property>

          <child>
            <widget class=3D"GtkTreeView" id=3D"tree_monedas">
              <property name=3D"border_width">1</property>
              <property name=3D"visible">True</property>
              <property name=3D"can_focus">True</property>
              <property name=3D"headers_visible">True</property>
              <property name=3D"rules_hint">False</property>
              <property name=3D"reorderable">False</property>
              <property name=3D"enable_search">True</property>
            </widget>
          </child>
        </widget>
        <packing>
          <property name=3D"padding">0</property>
          <property name=3D"expand">True</property>
          <property name=3D"fill">True</property>
        </packing>
      </child>

      <child>
        <widget class=3D"GtkHBox" id=3D"hbox1">
          <property name=3D"visible">True</property>
          <property name=3D"homogeneous">False</property>
          <property name=3D"spacing">0</property>

          <child>
            <widget class=3D"GtkButton" id=3D"but_agregar">
              <property name=3D"visible">True</property>
              <property name=3D"can_focus">True</property>
              <property name=3D"label" translatable=3D"yes">Agregar
Moneda</property>
              <property name=3D"use_underline">True</property>
              <property name=3D"relief">GTK_RELIEF_NORMAL</property>
            </widget>
            <packing>
              <property name=3D"padding">0</property>
              <property name=3D"expand">True</property>
              <property name=3D"fill">False</property>
            </packing>
          </child>

          <child>
            <widget class=3D"GtkButton" id=3D"but_editar">
              <property name=3D"visible">True</property>
              <property name=3D"can_focus">True</property>
              <property name=3D"label" translatable=3D"yes">Editar
Moneda</property>
              <property name=3D"use_underline">True</property>
              <property name=3D"relief">GTK_RELIEF_NORMAL</property>
            </widget>
            <packing>
              <property name=3D"padding">0</property>
              <property name=3D"expand">True</property>
              <property name=3D"fill">False</property>
            </packing>
          </child>

          <child>
            <widget class=3D"GtkButton" id=3D"but_eliminar">
              <property name=3D"visible">True</property>
              <property name=3D"can_focus">True</property>
              <property name=3D"label" translatable=3D"yes">Eliminar
Moneda</property>
              <property name=3D"use_underline">True</property>
              <property name=3D"relief">GTK_RELIEF_NORMAL</property>
            </widget>
            <packing>
              <property name=3D"padding">0</property>
              <property name=3D"expand">True</property>
              <property name=3D"fill">True</property>
            </packing>
          </child>

          <child>
            <widget class=3D"GtkButton" id=3D"but_salir">
              <property name=3D"visible">True</property>
              <property name=3D"can_focus">True</property>
              <property name=3D"label" translatable=3D"yes">Salir</property=
>
              <property name=3D"use_underline">True</property>
              <property name=3D"relief">GTK_RELIEF_NORMAL</property>
            </widget>
            <packing>
              <property name=3D"padding">0</property>
              <property name=3D"expand">True</property>
              <property name=3D"fill">False</property>
            </packing>
          </child>
        </widget>
        <packing>
          <property name=3D"padding">9</property>
          <property name=3D"expand">False</property>
          <property name=3D"fill">True</property>
        </packing>
      </child>
    </widget>
  </child>
</widget>

</glade-interface>




----------------------------------------------

this is de ouput of compiling


[jdegante@jorge monedas]$ mcs -r glib-sharp.dll -r gtk-sharp.dll -r
glade-sharp prueba.cs
prueba.cs(31) error CS0103: The name `TYPE_STRING' could not be found in
`prueba'
A:P:
PP:: OUT, ISBYREF
PT:  False
prueba.cs(33) error CS1502: The best overloaded match for method 'void
Gtk.ListStore.Append (out Gtk.TreeIter)' has some invalid arguments
prueba.cs(33) error CS1503: Argument 1: Cannot convert from
'Gtk.TreeIter' to 'out Gtk.TreeIter'
prueba.cs(33) error CS-0006: Could not find any applicable function for
this argument list
prueba.cs(34) error CS1502: The best overloaded match for method 'void
Gtk.ListStore.SetValue (Gtk.TreeIter, int, GLib.Value)' has some invalid
arguments
prueba.cs(34) error CS1503: Argument 3: Cannot convert from 'string' to
'GLib.Value'
prueba.cs(34) error CS-0006: Could not find any applicable function for
this argument list
prueba.cs(35) error CS1502: The best overloaded match for method 'void
Gtk.ListStore.SetValue (Gtk.TreeIter, int, GLib.Value)' has some invalid
arguments
prueba.cs(35) error CS1503: Argument 3: Cannot convert from 'string' to
'GLib.Value'
prueba.cs(35) error CS-0006: Could not find any applicable function for
this argument list
prueba.cs(42) error CS0103: The name `treee_monedas.Add' could not be
found in `prueba'
Compilation failed: 11 error(s), 0 warnings



thanks in advance for any help.


--=20
Jorge De Gante Tellez
jdegante@linuxware.com.mx
LinuxWare S.A. de C.V.
http://www.linuxware.com.mx
Tel. 26-03-15-15 26-03-15-16 26-03-15-17=20
Fax 26-03-15-18