Need the Event For Connector in Visio while Source or Destinitaion changes.

Started by chitta_pk, January 21, 2009, 06:32:14 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

chitta_pk

Hi ,
I am Developing an Window Application in C#.net.
I have added "Microsoft Office Visio 12.0 Drawing Control" in my ToolBox.

I need to prepare AuditLog for all the shapes(added , deleted or connected to other shapes)

I am getting events for Shape added or deleted from the default event list provided properties of the Drawing Page.

But I am not getting Event for Connector. I have to audit for each action of Connector like (if I change the source or destinition of connector  or connected to some other shape).

Kindly Suggest.

Regards
Chitta ranjan


aledlund

The issue your facing is that it is a cell changed event that you are looking for (and they happen a lot). One technique is to separate you event handling from general handling and then have a separate event class for forumula changed (the sdk shows an example of this).

I use something like this to track custom properties and 1d shapes (connectors and shapes configured as 1d)



Public Sub AddFormulaModifiedEventHandler(vsoDoc As Visio.Document)
   
    Dim objEvent As Visio.Event
    Dim vsoDocEvents As Visio.EventList

   ' Have Visio send send notification of formula changed events
    ' to mvsoFormEventSink.
   
    Set mvsoFormEventSink = New clsFormulaModifiedEventSink
   
    Set mvsoFormEventSink.pVsoApp = Visio.Application
    Set mvsoFormEventSink.pvisDoc = Visio.Application.ActiveDocument
   
    Set vsoDocEvents = vsoDoc.EventList
   
    Set objEvent = vsoDocEvents.AddAdvise( _
        Visio.VisEventCodes.visEvtFormula + Visio.VisEventCodes.visEvtMod, _
        mvsoFormEventSink, _
        "", _
        "")
   
    ' Filter which formula changed events get to vsoEventSink.
    ' Reduce the list to only the events during which the value
    ' of a custom property or 1d shapes is modified.
   
    Dim intCellFilter(1 To 14) As Integer
   
    ' do the custom properties section
    intCellFilter(1) = Visio.visSectionProp
    intCellFilter(2) = Visio.visRowFirst
    intCellFilter(3) = Visio.visCustPropsValue
    intCellFilter(4) = Visio.visSectionProp
    intCellFilter(5) = Visio.visRowLast
    intCellFilter(6) = Visio.visCustPropsValue
    intCellFilter(7) = True
   
    ' do the 1d section
    intCellFilter(8) = Visio.visSectionObject
    intCellFilter(9) = Visio.visRowFirst
    intCellFilter(10) = Visio.vis1DBeginX
    intCellFilter(11) = Visio.visSectionObject
    intCellFilter(12) = Visio.visRowLast
    intCellFilter(13) = Visio.vis1DEndY
    intCellFilter(14) = True
   
    objEvent.SetFilterSRC intCellFilter


End Sub