[Gtk-sharp-list] treeview and date columns

Eric Sanford rastaman@ceejs.com
Tue, 16 Nov 2004 13:04:13 -0500 (EST)


treeview and date columns

Hi all
	I am trying to make a littal program using a Gtk# TreeView, and i dont
know alot about GTK. I am just looking at the mono documentation and Gtk#
api.  I'm trying to make a list whith 3 feilds, ek, name, date.  i add the
columns as text and conver to text when i add the rows. But im getting
warnings when i add a row and when the currsor moves over each row. also
the Date field does not show.

this is on windows2000 and mono 1.0.4 .

at class level i have a ref to the TreeStore
TreeStore 	mDBStore;


here's the init of the treeview, in the class constructor:

			treeviewDB.HeadersVisible = true;
			treeviewDB.AppendColumn ( "ek", new CellRendererText (), "text", 0);
treeviewDB.AppendColumn ( "Name", new CellRendererText (), "text", 1);
treeviewDB.AppendColumn ( "Date", new CellRendererText (), "text", 2);
//treeviewDB.Columns[0].Visible = false;
			mDBStore = new TreeStore ( typeof (System.Int32) , typeof
(System.String) , typeof (System.DateTime) );
			treeviewDB.Model = mDBStore;


and i try to fill it with test data from one of the menuitems:

		void on_mnunew1_activate (object o, EventArgs args)
		{
			try {
				mDBStore.Clear();
				for (int i=0; i<5; i++)
				{
					DateTime dt = DateTime.Now;
					dt = dt.AddHours( (double)i );

					//Console.WriteLine( "{0} {1}", dt.ToString("d") , dt.ToString("t") );

					TreeIter iter = mDBStore.AppendValues( i , "CD_" +
Convert.ToString(i) , dt.ToString("d") + dt.ToString("t")  );
				}

				treeviewDB.Model = mDBStore;
			}
			catch (Exception e)
			{
				Console.WriteLine( "on_mnunew1_activate Exception '{0}'" ,
e.ToString()  );
			}
		}


when filling the treeview i get this warning for each line
(<unknown>:1144): Gtk-WARNING **: gtktreestore.c:820: Unable to convert
from gchararray to gpointer

and i get this every time i move the mouse
(<unknown>:1144): GLib-GObject-WARNING **: unable to set property `text'
of type `gchararray' from value of type `gpointer'