This project is read-only.

Possible confusion & bugs from OnInsert's "index" vs. dragContent.InsertIndex

Jul 16, 2014 at 10:40 PM
Hi, first of all thanks lots for creating this software. It works great and I truly appreciate it. :)

I had an error in my code where OnInsert would use the wrong target index. In fact the "index" parameter was completely fine; my problem was that I didn't use it.
OnInsert also receives a DragContent object (in the form of object obj).
This DragContent object has an InsertIndex property which is easily accessed.

The problem is, that InsertIndex property has an intermittently wrong value.

Most of the time (75%+) it's the same as "index"; sometimes, it's different. Only one time it was -1; more often it was a usable but incorrect value,
(For the curious: The more often I did it, the less matches there were. 25 checks, 100% match, 50 checks, 85% match, 75-100 checks, 75% match between index and the DragContent's InsertIndex.)

It would be a little more solid if either those values would match all the time, or you would not have access to the DragContent's InsertIndex in this context.

Thanks again,
Jul 31, 2014 at 11:40 PM
If you're dragging from one treeview to another, you get the drag index from the treeview you dragged from rather than the one you dragged to. I wound up having to add an insert index (based on the position of the target tree's insert decorator) for that reason. It's probably best to just remove the one in DragContext.