Intercepting Object Additions to the Doc


I am using the GoPalette to drag and drop GoNodes onto a GoView. I want to intercept the process before the GoNode is added to the Document and then replace it with a new instance of my own GoNode. Do I need to cancel the View’s Document changing event? If so, how?
Thank You,
Ron Moore


The easiest thing to do is to replace it after the objects are dropped. Just implement a GoView.ExternalObjectsDropped event handler to examine the view’s selection. Iterate through the selection to add what you really want to add to the document, with the same position/size, and then delete the selection. I suppose you’ll want to select all the new objects then.