DocView.EventSinkService.NodeMouseEnter?


Author
Message
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
Hi Jason,

You need to hook the Document.EventSinkService.NodeMouseEnter event, because shapes are nodes that reside in the document scene tree. Because this event is a bubbling event, you need to filter the objects for which this event is raised:

document.EventSinkService.NodeMouseEnter += ...;

void OnNodeMouseEnter(NNodeViewEventArgs args)
{
if (args.Node is NShape == false)
return;

// the shape, which the mouse enters
NShape shape = args.Node as NShape;
}

In general if you want to hook a specific event for all nodes, you never need to iterate all nodes and subscribe for this event, because in the diagram they will all dispatch the event to the event sink service.

The previous sample will work regardless of the shapes in the diagram (e.g. you can add/remove shapes) and still will receive mouse enter for the current set of shapes in the drawing.

For more information take a look at this topic in the Users Guide:
Diagram for .NET > User's Guide > Conceptual Overview > Diagram Services




Best Regards,
Nevron Support Team


Jason Irby
Jason Irby
Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)
Group: Forum Members
Posts: 59, Visits: 77

 

I am having trouble getting this event to work.  I want the document view to tell me anytime the mouse has entered a node on that drawing.

I have created an event handler for DocView.EventSinkService.NodeMouseEnter but it never appears to fire.

If I hook up to each shapes EventSinkService.NodeMouseEnter I can then get the event, but not on the docview directly.

The problem is I might have loaded a doc with 100 existing shapes.  Do I have to iterate over all the shapes and hook up their mouseEnter event at load time?  I might be misunderstanding.  I was hoping the doc view could be a single place to hook that up.

Do I have to hook each shape individually?  Other events like NodeSelected I was able to hook up at the DocView level.

 

Thanks in advance,

Jason


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search