[Gtk-sharp-list] Cancel Drag & Drop nefore it really starts

TheSHEEEP thesheeep2 at web.de
Fri Feb 3 09:52:34 UTC 2012


Hey there,

I am planning to have two TreeViews, and both should have items that can be
dragged & dropped into each other.
However, there are also "category" nodes that include the actual data nodes.

I do not want a whole "category" node to be dragged around, only its child
items.
Now my question: How would I prevent the dragging of such a node?

What I tried was the following:

//-------------------------------------------------------------
//-------------------------------------------------------------
treeView.DragBegin += HandleMyDragBegin;
.....

[GLib.ConnectBefore]
void HandleMyDragBegin (object o, DragBeginArgs args)
{
	TreeIter iter;
	if (treeView.Selection.GetSelected(out iter)) 
	{
		...find out if selected node is a category, works...
		if (isCategory)
		{
			*args.RetVal = false;*
		}
	}
}
//-------------------------------------------------------------
//-------------------------------------------------------------

But that did not achieve anything.
Is there even a way to stop the dragging or is the best I can do to not
accept the "category" node when dropped?

--
View this message in context: http://mono.1490590.n4.nabble.com/Cancel-Drag-Drop-nefore-it-really-starts-tp4354127p4354127.html
Sent from the Mono - Gtk# mailing list archive at Nabble.com.


More information about the Gtk-sharp-list mailing list