Hello again,

I attached a simple sample file to make it clearer.

mcs Drag.cs /pkg:gtk-sharp

or gtk-sharp-2.0 works equally.

Thanks,
Sebastian
using System;
using Gtk;


public class
TestDragAndDrop
{
	public static void Main (string[] args)
	{
		Application.Init ();

		TestDragAndDrop dnd = new TestDragAndDrop ();
		dnd.Init ();

		Application.Run ();
	}

	public void Init ()
	{
		Window win = new Window ("Test drag and drop");
		win.DeleteEvent += new DeleteEventHandler (DeleteWindow);
		win.SetDefaultSize (640, 480);

		ListStore list = new ListStore (typeof (string), typeof (string));
		list.AppendValues ("1", "A");
		list.AppendValues ("2", "B");
		list.AppendValues ("3", "C");
		list.AppendValues ("4", "D");

		/* Connect to the RowsReordered event to be notified of drag-row
		 * actions of the user.
		 */
		list.RowsReordered += OnReorderRows;

		TreeView tv = new TreeView (list);
		tv.AppendColumn ("Number", new CellRendererText (), "text", 0);
		tv.AppendColumn ("Character", new CellRendererText (), "text", 1);
		tv.Reorderable = true;
		tv.Model = list;

		win.Add (tv);
		win.ShowAll ();
	}

	private void OnReorderRows (object obj, RowsReorderedArgs reorder)
	{
		Console.WriteLine ("User reordered rows.");
	}

	private void DeleteWindow (object obj, DeleteEventArgs args)
	{
		Application.Quit ();

		args.RetVal = true;
	}
}


_______________________________________________
Gtk-sharp-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

Reply via email to