locked
MSAGL events for edge creation, moving nodes etc. RRS feed

  • Question

  • Hi, I am using the MSAGL gviewer in an tool I'm developing.  Referring to the GraphEditor example code I am able to add nodes and so forth in my own GViewer.

    GViewer has built-in functionality for adding edges between nodes and for moving nodes around.  I'd just as soon use these features, but... there seems to be no way for me to tell when an edge is added or a node is moved.

    I would have expected both of these to raise events but I can't find them.  Another way would be to subclass GViewer and overload some of its functions to call a base class and raise an event, but the base functions that would matter aren't virtual.

    Am I missing something?  Is there a reasonable way for me to add this functionality?  As the graph changes, I need to manipulate related data structures behind the scenes.  Events is the C-sharpy thing to do but I'm open to any workarounds you'd suggest.

    thanks,

    h

    Wednesday, November 7, 2012 1:28 AM

Answers

  • Answering my own question in part... it looks like the only way to do it is to handle the mouse down and up events and check the gViewer's "ObjectUnderMouseCursor" to detect start and end node hits, and add the edge manually.  I have yet to sort out the details of how to prevent the underlying system from adding a redundant edge, but it should be doable.

    If anyone has a better answer or additonal suggestions/tips/refinements please do share them.

    thanks,

    h

    • Marked as answer by Lev Nachmanson Friday, November 16, 2012 7:05 PM
    Wednesday, November 7, 2012 10:49 PM