[Gtk-sharp-list] override TreeDragSource Interface method in TreeStore sub-class

David Cantin david_cantin at videotron.ca
Fri Jan 12 13:55:23 EST 2007


Hi, I got a sub-class of a TreeStore (see below) and I want to cancel a
DND operation if it's not apropriate. But my RowDraggable method is
never called.. I'am missing something ?


public class MyTreeStore : TreeStore, TreeDragSource {
	
	public MyTreeStore(params System.Type[] p) : base(p) {
	}
	
	bool TreeDragSource.RowDraggable(TreePath path){
		Console.WriteLine("RowDraggable...");
		return false;
	}
}


I use it in a sub-class of a TreeView that goes like that :

public class MyTreeView : TreeView {

	public MyTreeView(){

		this.Reorderable = true;

		this.AppendColumn ("Col1", new CellRendererText(), "text", 0);
		this.AppendColumn ("Col2", new CellRendererText(), "text", 1);
			
		this.Model = new MyTreeStore(
			typeof(string),
			typeof(string)			
		);
		
		((MyTreeStore)this.Model).AppendValues(
			"L1C1",
			"L1C2"
		);

		((MyTreeStore)this.Model).AppendValues(
			"L2C1",
			"L2C2"
		);
	}	
}

I known that there is some subtilities to override Interface methods in
sub-classes in C# but, as far as I know, my code take care of it..

Any tought ?

David



More information about the Gtk-sharp-list mailing list