SetFilterObjects method

Microsoft Visio Developer Reference

SetFilterObjects method

   Example   

Specifies an array of object types and a True or False value indicating how to filter events for each object.

Version added

2002

Syntax

object.SetFilterObjects objects

object

Required. An expression that returns an Event object.

objects

Required Long. An array of objects types and a True or False value specifying how to filter events for each object type.

Remarks

When an Event object created with the AddAdvise method is added to the EventList collection of a source object, the default behavior is that all occurrences of that event are passed to the event sink. The SetFilterObjects method provides a way to ignore selected events based on object type.

The objects argument passed to SetFilterObjects is an array defined in the following manner.

The number of elements in the array is a multiple of 2:

  • The first element contains an object type (one of visTypePage, visTypeGroup, visTypeShape, visTypeForeignObject, visTypeGuide, or visTypeDoc).
  • The second element contains a True or False value indicating whether you are listening to events for that object (True to listen to an object's events; False to exclude an object's events).

For an event to successfully pass through an object event filter, it must satisfy the following criteria:

  • It must be a valid object type.
  • If all filters are True, the event must match at least one filter.
  • If all filters are False, the event must not match any filter.
  • If the filters are a mixture of True and False, the event must match at least one True filter and not match any False filters.

If there are no True ranges defined in the array, events are considered True.

For example, if you want to listen only to events sourced by a shape or guide, you can pass an array like the following:

Dim objArray (2 * 2) As Long
objArray(1) = visTypeShape
objArray(2) = True
objArray(3) = visTypeGuide
objArray(4) = True