[Gtk-sharp-list] Connecting to the RowsReordered event (ListStore)

halol halol at free.fr
Wed Jul 27 08:04:33 EDT 2005


Please, have a look at the following code:
****************************************************************************
using System;
using Gtk;

public class ListStoreTests {

	public static void Main(string[] args) { new ListStoreTests(args); }

	public ListStoreTests(string[] args) {
		Application.Init();

		ListStore store = new ListStore(typeof(string));
		store.AppendValues("entry 1");
		store.AppendValues("entry 2");
		store.RowsReordered += OnRowsReordered;

		TreeView treeView = new TreeView();
		treeView.Model = store;
		treeView.Reorderable = true;
		treeView.AppendColumn ("col", new CellRendererText (), "text", 0);
		
		Window win = new Window("ListStore tests");
		win.Resize(200,200);
		win.Add(treeView);
		win.ShowAll();

		System.Console.WriteLine("reordering");
		store.SetSortColumnId(0, SortType.Descending);
		

		Application.Run();
	}
	
	void OnRowsReordered(object source, EventArgs args)  
{ System.Console.WriteLine("reordered"); }
}
****************************************************************************

Is there something wrong here? If not, could somebody try to compile and  
execute it please? I would really like to know if I am the only one with  
this problem...

In my application, users can reorder the rows in a TreeView using drag &  
drop. Is there any other way to be notified when such an event occurs?

Thanks in advance.
Olivier


More information about the Gtk-sharp-list mailing list