Selective Drag and Dropping


#1

I’ve just started using the go tools and I was curious about some functionality. I have a go view that contains several nodes. I also have several other nodes in a go palette. These nodes are of two types, assignment nodes and resource nodes. Assignments nodes should show up in the view, while resource nodes should only be allowed to be dropped on an assignment node already contained in the view. So how would you suggest that I handle this functionality? I just basically want the view to not allow a person to drag and drop a resource node on to the blank background of the view, they should drag and drop it on another node, then the resource node should go away and the resource count on the assignment node that was currently dropped on increments. I apoligize for being long winded, I just thought that more information is better than less.
Thanks everyone,
Ryan


#2

Well I’ve figured out a considerable amount of the functionality. Currently, if they drop a new node on the background, opposed to on an assignment node, i just remove the node from the document. Can someone point me to a example where I can possibly change the node icon during a drag, I would like to change it to a red x or something similar when the node isn’t currently dragging over an assignment node, but is over the background of the view.


#3

Although i’ve not actually used this method, the documentation seems to suggest that overriding GoView.DoExternalDrag will allow you to examine the object being dragged and make the appropriate response.



Ian


#4
Override GoView.DoExternalDrag to set the DragEventArgs.Effect property to DragDropEffects.None when the currently dragged object is a "resource"-type node and there's no "assignment"-type node at the this.LastInput.DocPoint. How can you tell what kind of object is currently being dragged? Look at the DragEventArgs's DataObject when it is a GoSelection: Object docobj = evt.Data.GetData(typeof(GoSelection)); if (docobj is GoSelection) { GoSelection sel = (GoSelection)docobj; if (sel.Primary ...) ... // ??? }