BackgroundSelectionDropped - Dropped vs Dragged


I have a GoView where I am handling the BackgroundSelectionDropped event, however I have noticed that this event is raised when a GoShape is dropped (from another palette - similar to the FLowGrammer) as well as when a shape is simply moved within the GoView.
Is there a way to determine if a shape has been added opposed to moved? I only need my code to execute if a new shape has been added to the GoView.

You can implement a GoView.ExternalObjectsDropped event handler.

<?:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Apologies, I should have stated that I’m developing a Web Application - ExternalObjectsDropped isn’t available in GoView for Web?

If the SelectionMoved event fired before the BackgroundSelectionDropped event that would be suffecient.

I wondered about that when I was writing the answer… sorry, I tend to assume WinForms unless the question specifies otherwise.

here's probably your best option:

In your Document class, add a GoDocument.Changed event handler:
this.Changed += new GoChangedEventHandler(GraphDoc_Changed);
void GraphDoc_Changed(object sender, GoChangedEventArgs e) {
if (e.Hint == GoLayer.InsertedObject) {

Thanks for the suggestion, but at the moment it doesn’t appear as though it is going to provide a solution.

I really need to be able to determine if an object has been added or moved from a GoView event. Our application loads/unloads multiple documents (in/out of the one GoView) and each time a document is loaded the changed event is raised (for the document) with e.Hint == GoLayer.InsertedObject evaluating to true as it renders and adds objects to the document - which in my case won't work as I only want/need to know about new objects added/inserted by the end user.
I'll keep trying and see if I can some up with a solution, if you think of anything please let me know.

Can you just set a “loading” flag for when you are loading from a document?

The easiest way to tell is by looking at GoView.Tool to see if the current tool is of type GoToolDragging (or subtype). If it is, then the drag started in that GoView. If it isn’t, it must have started somewhere else.

You can check that in your GoView.BackgroundSelectionDropped event handler or GoView.ObjectSelectionDropped event handler or override of GoObject.OnSelectionDropped.

All of this information applies to both Web Forms and Win Forms.

Yeah, I thought of doing that but it didn't seem like a "clean" workaround.
This worked perfectly, thanks!!