method PropertiesList.Add (Property as String, Value as Variant, Type as EditTypeEnum, [Description as Variant], [Parent as Variant], [Template as Variant])
Adds a custom property to the list.

   Property as String A string expression that indicates the property's name.  
   Value as Variant A Variant value that indicates the property's value.  
   Type as EditTypeEnum An EditTypeEnum expression that indicates the property's built-in editor.  
   Description as Variant A string expression that indicates the property's description.  
   Parent as Variant A string expression that indicates the name of the parent property, or a long expression that indicates the identifier of the parent property.  
   Template as Variant Reserved.  
  PropertyA Property object that represents the newly created object. Use Property property to get a property based on its name or based on its identifier. 

The Add method adds a new property to the current list. The Add method associates to the newly created Property object an identifier, that's unique. Use the ID property to get the property's identifier. Use the Remove property to remove a property from the collection. Use the UserData property to associate  an extra data to a property. Use the PropertyChange event to notify your application when a property's value is changed. Use the AddValue method to add new values to a drop down editor ( EditEnum, EditDropDown types ). Use the Select method to browse for a new COM object. Use the HTMLName property to assign icons, pictures, font attributes or colors, to parts of the caption being displayed in the Name column. Use the Option property to specify custom settings for editor assigned to a property. If the AllowDuplicateEntries property is False, the Add method does not add a new property with a name that's already shown on the Name column.

The following adds few properties with different editors, to the ExPropertiesList control:

With PropertiesList1
    .Add "ReadOnly", "", EXPROPERTIESLISTLibCtl.ReadOnly, "The property is read only"
    .Add "Edit", Me.Caption, EXPROPERTIESLISTLibCtl.Edit, "The property uses a standard edit control, to change the property's value."
    .Add "Color", Me.BackColor, EXPROPERTIESLISTLibCtl.EditColor, "The property uses a drop down color list to change the property's value."
    .Add "Font", Me.Font, EXPROPERTIESLISTLibCtl.EditFont, "The property uses a font property page to change the property's value."
    .Add "FontName", Me.Font, EXPROPERTIESLISTLibCtl.EditFontName, "The property uses a drop down font name list to change the property's value."
    .Add "Picture", Me.Icon, EXPROPERTIESLISTLibCtl.EditPicture, "The property uses picture page to change the property's value."
    .Add "Page", Me.Icon, EXPROPERTIESLISTLibCtl.EditPage, "The property uses a custom page to change the property's value."
    .Add "Boolean", Me.Visible, EXPROPERTIESLISTLibCtl.EditBoolean, "The property uses a boolean combo."
    With .Add("Enum", Me.BorderStyle, EXPROPERTIESLISTLibCtl.EditEnum, "Not available in DEMO version")
        .AddValue 0, "0 - None"
        .AddValue 1, "1 - Fixed Single"
        .AddValue 2, "2 - Sizable"
        .AddValue 3, "3 - Fixed Dialog"
        .AddValue 4, "4 - Fixed ToolWindow"
        .AddValue 5, "5 - Sizable ToolWindow"
    End With
    .Add "Date", Date, EXPROPERTIESLISTLibCtl.EditDate, "Edits a value of DATE type"
    .Add "Password", "Password", EXPROPERTIESLISTLibCtl.EditPassword, "Edits a password"
    With .Add("DropDown", "Mr.", EXPROPERTIESLISTLibCtl.EditDropDown, "Specifies a list of predefined values, but allow custom entries too.")
        .AddValue 0, "Mr."
        .AddValue 1, "Ms."
        .AddValue 2, "Dr."
    End With
End With

The following sample shows how to add new items for a property of EditEnum type:

Dim p As Property
Set p = PropertiesList1.Add("Enum", 1, EditEnum)
p.AddValue 0, "Zero"
p.AddValue 1, "One"
p.AddValue 2, "Two"

You need to call Refresh method because the values for the property were unknown at adding time.

The following sample adds two COM objects to the same browser:

With PropertiesList1
            .Add "PropertiesList", PropertiesList1.Object, EXPROPERTIESLISTLibCtl.EditObject
            .Add "Form", Me, EXPROPERTIESLISTLibCtl.EditObject
End With

The following sample adds a root property and two child properties:

With PropertiesList1
            .Add("Root", "", ReadOnly).ID = 1234
            .Add("Child", "", Edit, , 1234).ID = 1235
            .Add "SubChild", "", Edit, , 1235
End With

Send comments on this topic.
1999-2017 Exontrol.COM, Software. All rights reserved.