MarkerEvent event

Microsoft Visio Developer Reference

MarkerEvent event

       

Caused by invoking the QueueMarkerEvent method.

Version added

5.0

Syntax

Private Sub object_MarkerEvent(ByVal app As IVApplication, ByVal SequenceNum As Long, ByVal ContextString As String)

object

The WithEvents object that receives the event.

SequenceNum

The ordinal position of this event with respect to past events.

ContextString

Context string passed by the QueueMarkerEvent method.

Remarks

Unlike other events that Visio fires, a client program causes the MarkerEvent event to fire. A client program receives the MarkerEvent event only if the client program invoked the QueueMarkerEvent method.

By using the MarkerEvent event in conjunction with the QueueMarkerEvent method, a client program can queue an event to itself. The client program receives the MarkerEvent event after Visio fires all the events present in its event queue at the time of the QueueMarkerEvent call.

The MarkerEvent event passes both the context string that was passed by the QueueMarkerEvent method and the sequence number of the MarkerEvent event to the MarkerEvent event handler. Either of these values can be used to correlate QueueMarkerEvent calls with MarkerEvent events. In this way, a client program can distinguish events it caused from those it did not cause.

For example, a client program that changes the values of Visio cells may only want to respond to the CellChanged events that it did not cause. The client program can first call the QueueMarkerEvent method and pass a context string for later use to bracket the scope of its processing:

visObj.QueueMarkerEvent "ScopeStart"
    <My program changes cells here>
visObj.QueueMarkerEvent "ScopeEnd"

Then, in the MarkerEvent event handler, the client program could use the context string passed to the QueueMarkerEvent method to identify the CellChanged events that it caused:

Dim ICausedCellChanges as Boolean

Private Sub visObj_MarkerEvent (ByVal App As Visio.IVApplication, _
    ByVal SequenceNum As Long, ByVal ContextString As String)
    If ContextString = "ScopeStart" Then
        ICausedCellChanges = True
    ElseIf ContextString = "ScopeEnd" Then
        ICausedCellChanges = "False"
    End If
End Sub

Private Sub visObj_CellChanged (ByVal Cell As Visio.IVCell)
    'Respond only if this client didn't cause cell change
    If ICausedCellChanges = False Then
        <respond to the cell changes>
    End If
End Sub 

If you're using Microsoft Visual Basic or Visual Basic for Applications, the syntax in this topic describes a common, efficient way to handle events.

If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.

If you are handling this event from a program that receives a notification, the MarkerEvent event is one of one of a group of events that record extra information in the EventInfo property of the Application object.

The EventInfo property returns contextstring as described above. The vMoreInfo argument to VisEventProc will be empty.