event IncludeProperty (Property as Property, Cancel as Boolean)

Fired when the properties browser is about to include a new property.

 TypeDescription 
   Property as Property A Property object that contains information about the item that is going to be included.  
   Cancel as Boolean A boolean expression that indicates whether the property is excluded or included.  

Use the IncludeProperty event to filter the object properties. The event is fired only if the FireIncludeProperty property is True. Use the Cancel argument of the event to include or exclude a property. Use Cancel = True to exclude a property from the list. Use the HTMLName property to display HTML format in the Name column.

For instance, if the control's ShowVariables is True, the control includes also the variables for an IPictureDisp object ( hPal variable ).

The following sample shows how to exclude variables of IPictureDisp ( picture) properties:

Private Sub PropertiesList1_IncludeProperty(ByVal Property As EXPROPERTIESLISTLibCtl.IProperty, Cancel As Boolean)
    If Not (Property.Object Is Nothing) Then
        Cancel = Property.Variable And TypeOf Property.Object Is IPictureDisp
    End If
End Sub

The following sample includes only the properties of IFontDisp type, and their variables:

Private Sub PropertiesList1_IncludeProperty(ByVal Property As EXPROPERTIESLISTLibCtl.IProperty, Cancel As Boolean)
    Cancel = Not Property.Type = "Font*"
    If (Cancel) Then
        If Not (Property.Object Is Nothing) Then
            Cancel = Not Property.Variable
        End If
    End If
End Sub

The following sample include only the properties of boolean type, and properties of Object type:

Private Sub PropertiesList1_IncludeProperty(ByVal Property As EXPROPERTIESLISTLibCtl.IProperty, Cancel As Boolean)
    Cancel = Not Property.Type = "BOOL"
    If (Cancel) Then
        Cancel = Not Property.PropertyObject
    End If
End Sub

The following sample includes all properties contained by "Misc" category:

Private Sub PropertiesList1_IncludeProperty(ByVal Property As EXPROPERTIESLISTLibCtl.IProperty, Cancel As Boolean)
    Cancel = Not (Property.CategoryName = "Misc")
End Sub

The following sample shows how to simulate the VB browser ( the ShowObjects property is True ):

Private Sub PropertiesList1_IncludeProperty(ByVal Property As EXPROPERTIESLISTLibCtl.IProperty, Cancel As Boolean)
    Cancel = Property.PropertyObject
    If (Cancel) Then
        Cancel = Not (Property.Type = "Font*" Or Property.Type = "Picture*")
    End If
End Sub

The following sample shows how to include into your browser only the property pages:

Private Sub PropertiesList1_IncludeProperty(ByVal Property As EXPROPERTIESLISTLibCtl.IProperty, Cancel As Boolean)
    Cancel = Not Property.PropertyPage
End Sub

Here's a sample that shows how to include only hidden members:

Private Sub PropertiesList1_IncludeProperty(ByVal Property As EXPROPERTIESLISTLibCtl.IProperty, Cancel As Boolean)
    Cancel = Not (Property.Flags And &H40) = &H40
End Sub

The following sample excludes the "hPal" variable of a Picture property:

Private Sub PropertiesList1_IncludeProperty(ByVal Property As EXPROPERTIESLISTLibCtl.IProperty, Cancel As Boolean)
    If Property.Variable = True Then
        If Property.Name = "hPal" Then
            Cancel = True
        End If
    End If
End Sub

Send comments on this topic.
© 1999-2008 Exontrol Inc, Software. All rights reserved.