This project has moved and is read-only. For the latest updates, please go here.

Handling events for mouseclick

Sep 19, 2012 at 2:14 PM

What is the best way to handle mouseclick events for shapes?

I noticed there are 2 event message types:

1.) DiagramPresenterShapesEventArgs

2.) UserMessageEventArgs

what are these 2 used for?

Basically I want to code logic on the mouseclickevent of a shape.

Can you explain also, the eventing cycle? what gets trigerred first, and does the event bubble up and bubble down?

Sep 19, 2012 at 3:11 PM

The 'best way' depends on what you want do. If a simple ShapeClick is suitable for you, simply use the Display.ShapeClick / Display.ShapeDoubleClick / Display.ShapesSelected event. The clicked/selected shapes are stored in the event args.
You can also use the Events of the Display's "CurrentTool" (which defines what you can do with the mouse cursor) or the standard mouse events of the Display.

The UserMessage event is used for displaying messages issued by non visual components.

WPF-style event bubbling is not supported.

If you want to investigate the events, start the NShape Designer, select the menu item "Tools > NSHape Event Monitor" and check some of the components in the list. All events raised by the checked components will be listed in the list on the right (including timestamp).