Profile Picture

DocView.EventSinkService.NodeMouseEnter?

Posted By Jason Irby 14 Years Ago
Author
Message
Nevron Support
Posted 14 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009
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
Posted 14 Years Ago
View Quick Profile
Forum Member

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
Last Active: 3 Years Ago
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





Similar Topics


Reading This Topic