[Gtk-sharp-list] Problem with TreeView on Win32

Jae Stutzman stutzmanj@argontech.net
Wed, 07 Jan 2004 22:11:24 -0600


I'm having the same crash. I'm trying to implement a directory tree view
with little folder images...using nunit-gtk as my model, and it crashes
during show_all as well. Also on Windows.

Anyone with a good known example that works on windows?

Thanks,
Jae

On Wed, 2004-01-07 at 21:50, Ivan Dubrov wrote:
> Hi, All!
> 
>   Just another question regarding GTK#. I've tried TreeView - basicly it 
> works, but when I use TreeCellDataFunc it crashes with 
> NullReferenceException at Gtk.Widget.gtk_widget_show_all. Here the code:
> 
> namespace GtkSamples
> {
>     using System;
>     using System.Drawing;
>     using System.Runtime.InteropServices;
>     using System.Reflection;
>     using Gtk;
>     using GtkSharp;
> 
>     public class TreeViewDemo
>     {
>         private static void CellData (Gtk.TreeViewColumn tree_column, 
> Gtk.CellRenderer cell, Gtk.TreeModel tree_model, Gtk.TreeIter iter)
>         {
>             ((CellRendererText) cell).Text = "a";
>         }
>        
>         public static void Main (string[] args)
>         {
>             Application.Init ();
> 
>             TreeStore store = new TreeStore(typeof(string));
>             string[] combs = {"foo", "bar", "baz", "quux"};
>             foreach (string a in combs)
>                 store.AppendValues (a);
> 
>             Window win = new Window ("TreeView demo");
>             TreeView tv = new TreeView (store);
>             tv.HeadersVisible = true;
> 
>             tv.AppendColumn ("One", new CellRendererText (), new 
> TreeCellDataFunc (CellData));
> // with string below everything is OK, but with string above application 
> crashes with an exception
> //            tv.AppendColumn ("One", new CellRendererText (), "text", 0);
>             win.Add(tv);
>             win.ShowAll ();
>             Application.Run ();
>         }
>     }
> }
> 
> Anybody knows what's the problem? Tested on Windows.
> 
> 
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list