I have a question about dragging from one goview to another. I am able to drag and drop the goobjects, but I cannot get a reference to the object that I copied from to remove it from the original goview. The ExternalObjectDropped event sender gives me the GoView that I am dropping on.
Ultimately, I need to know how to reference the item on the dragfrom goview (original) so that I can update the collection of GoObjects to remove the dragged one.
Or, is there a way to use the drag and drop to move items between GoViews?
Yes, the event sender is the target view, but the event Data gives you the selection (a GoSelection) which gives you everything you need.
Actually, that topic also had a more specific requirement than what you might need -- that the same object be added to the target view's document, not a copy. I think the code could be simpler if you don't mind the default behavior of having the target view's document get copies of the selected objects.
I’ll give it a go. Thanks so much for your time.
I wanted to report back.
I found a seemingly simple way to do a basic drag and drop from one GoView.Document to another GoView.Document. When the item is dragged from one GoView to another, the ExternalObjectsDropped event gets fired.
Private Sub goView_ExternalObjectsDropped(ByVal sender As System.Object, ByVal e As Northwoods.Go.GoInputEventArgs) Handles virtualBed.ExternalObjectsDropped' identify piece to delete from sending object (in e)End SubDim goSelection As GoSelection = CType(e.DragEventArgs.Data.GetData(GetType(GoSelection)), GoSelection)goSelection.View.Document.Remove(goSelection.Primary.DraggingObject)
Is there any major issue with calling Primary.DraggingObject?
Thanks as always.
That depends on what you want to do. If you support nested selections, then (probably) the GoObject.DraggingObject will be different from the selected object.
The other issue is that your code only addresses the first selected object; did you want to leave other selected objects alone, if there is a multiple selection?