ExPropertiesList Frequently Asked Questions
ExPropertiesList FAQ | Exontrol Docs
1:
The control's release notes can be found on our web site, looking for the Release Notes column in the control's main page. Click here for direct link.
2:
The control provides a Add method that allows you to add new items to the control. You can add items as a simple list or as a tree structure. The Add method returns a Property object that allows you to set the property attributes like: ForeColor, BackColor, Font, ReadOnly, etc. The Select method allows you to browse the properties of an object that implements the IDispatch interface. The Select method returns a Property object that allows you to set the property attributes like: ForeColor, BackColor, Font, ReadOnly, etc.

The following VB sample shows how to add few items to the control as a simple list:

Private Sub Form_Load()
	With PropertiesList1
	    .BeginUpdate
	        .Add "Property 1", 0, Edit, "Just a property"
	        .Add "Property 2", True, EditBoolean, "Just a boolean property"
	    .EndUpdate
	End With
End Sub

The following VB sample shows how to add few items to the control as a tree structure:

With PropertiesList1
	.BeginUpdate
	    With .Add("Group 1", "", ReadOnly, "Just a group")
	        .ID = 1234  ' Assign a identifier to the group
	    End With
	    With .Add("Property 1", 0, Edit, "Just a property", 1234)
	        .Numeric = True
	    End With
	    .Add "Property 2", True, EditBoolean, "Just a boolean property", 1234
	    .Add "Group 2", "", ReadOnly, "Just a group"
	    .Add "Property 1", True, EditBoolean, "Just a boolean property", "Group 2"
	    .Add "Property 2", False, EditBoolean, "Just a boolean property", "Group 2"
	.EndUpdate
End With
If you have a COM object (an object that exposes the IDispatch interface; any Object or Class that implements the IDispatch interface) and want to display its properties in the control, you must use the Select method. For instance, the following sample displays the properties of the Form object.

The following VB sample shows how to browse the properties of the Form object:

PropertiesList1.Select Me

The following VB sample shows how to browse the properties and fields of an ADO Recordset:

Dim rs As Object
Set rs = CreateObject("ADODB.Recordset")
rs.Open "Authors", "Provider=Microsoft.Jet.OLEDB.3.51;Data Source= D:\Program Files\Microsoft Visual Studio\VB98\Biblio.MDB", 3 ' Opens the table using static mode

PropertiesList1.Select rs

The following VB sample shows how to browse the properties of an ADO Recordset and set the property attributes:

Dim rs As Object

Private Sub Form_Load()
	Set rs = CreateObject("ADODB.Recordset")
	rs.Open "Authors", "Provider=Microsoft.Jet.OLEDB.3.51;Data Source= D:\Program Files\Microsoft Visual Studio\VB98\Biblio.MDB", 3 ' Opens the table using static mode

	With PropertiesList1
	    .BeginUpdate
	    .ShowReadOnly = False
	    .Select rs.Fields
	    .EndUpdate
	End With
	    
End Sub

If you define your own classes in the VB environment, you can also browse their properties using the control, as demonstrated in the following sample. Let's assume we have the following Class1 definition:

Dim clr As OLE_COLOR

Private Sub Class_Initialize()
	clr = vbBlue
End Sub

Property Get BackColor() As OLE_COLOR
	BackColor = clr
End Property

Property Let BackColor(ByVal newVal As OLE_COLOR)
	clr = newVal
End Property

We can browse the Class1 class using the statement:

PropertiesList1.Select new Class1
3:
The control provides a Property property that helps you to find an property given its identifier or its name. The property's ID property defines the property's identifier.

The following VB sample changes the foreground color for the property called "BackColor":

PropertiesList1.Property("BackColor").ForeColor = vbBlue
4:
The ExpandItem property expands an item given the property's identifier or the property's name. For instance the ExpandItem(1234) = True expands the property that has the identifier 1234 ( Property.ID ), or ExpandItem("Group 2") =  False collapses the property called Group 2.
5:
The Property object provides the properties like: CellForeColor, CellBackColor that helps you to colorize the cells in the control. The control provides also a property called BackColorAlternate that provides alternate colors for odd/even items. If the BackColorAlternate is 0 the control doesn't use the BackColorAlternate property.
6:
Yes, you can. The following method uses a for each statement.. 
Dim p As Property
For Each p In PropertiesList1
   Debug.Print p.Name
Next

The following method uses the Item and Count properties:

With PropertiesList1
    Dim i As Long
    For i = 0 To .Count - 1
        Debug.Print .Item(i).Name
    Next
End With
7:
The ColumnAutoResize property is what you are looking for. If the control's ColumnAutoResize property is True, the control arranges all visible columns to fit the control's client area. In this case no horizontal scroll bar is displayed. If the ColumnAutoResize property if False, control displays a horizontal scroll bar if the width of visible columns doesn't fit the width of the client area. You can use HeaderVisible property to show the control's header bar.
8:
Yes. You can find UNICODE versions here.
9:
Changing the Name property of the Font object does not notify the control that the font has been changed. Therefore, calling PropertiesList1.Font.Name = "Arial Unicode MS" affects only the control's drop-down window and does not update the font used by the text editors inside the control. Keep in mind that Font is a system object, not an object implemented by the control. As a result, the control is not notified when the font name is changed.

The following VB sample shows how to change the font at runtime:

Dim f As New StdFont
f.Name = "Arial Unicode MS"
PropertiesList1.Font = f
10:
The control provides an Interfaces property (which is hidden and therefore not displayed in the VB context window) that allows you to retrieve the list of interfaces implemented by an object.

The following VB sample displays the interfaces implemented by a Form object:

Debug.Print PropertiesList1.Interfaces(Me)
11:
The control supports a property of different types, including a property that uses a list of predefined values. You can use the EditEnum type when adding a property to the control. The AddValue method allows you to add values to the predefined list.

The following VB sample shows how to add a property that uses a list of predefined values:

With PropertiesList1
    With .Add("Enum", 1, EditEnum, "A property that uses a list of predefined values")
	    .AddValue 1, "Item 1"
	    .AddValue 2, "Item 2"
	    .AddValue 3, "Item 3"
	End With
	.Refresh
End With

Please note that the Refresh method is called after adding values to the predefined list. This is necessary because the list of predefined values is not available when the property is initially added, as the values are populated afterward.

12:
When you adding that property using the Add method you have to use the EditPassword type.
13:
The control's ReadOnly property is what you are looking for.
14:
The control fires the EditChange event while user alters the text into an edit fields. The event passes in the Value argument the current text in the edit field. By changing that value you can handle situation like this.
Private Sub PropertiesList1_EditChange(ByVal Property As EXPROPERTIESLISTLibCtl.IProperty, Value As Variant)
	Debug.Print Value
End Sub 
15:
The control provides a set of properties for customizing its appearance. You can adjust HasGridLines, HasLines, ShowCategories, MarkCategories, DefaultCategory, and GridLineColor to achieve a look similar to the .NET property grid. In addition, the control is fully skinnable through the VisualAppearance object, which lets you customize its appearance further.

The following VB sample demonstrates how to configure the control's appearance:

With PropertiesList1
    .BeginUpdate

	.HasGridLines = True
	.HasLines = False

	' Shows the categories
	.ShowCategories = True
	.MarkCategories = True
	.DefaultCategory = "Misc"
	.GridLineColor = &H80000003

	.EndUpdate
End With
16:
The control provides a property called InvalidValueMessage that helps you to change the caption for that error. If the property is empty no message box occurs.
17:
The NameItemsCollection property provides a list of values that indicates the name of the properties that control looks for when it browses a collection. For instance, if you have a collection of objects of the Field type. When control loads the  collection it interrogates each element for any property named in the NameItemsCollection. If the property is not found, the control displays the element's index instead. So make sure that one of the Field properties that you want to be displayed instead its index is listed in the NameItemsCollection property.
18:
The control loads only the required data from the object's type library. For instance, when a property of Object type is expanded the control queries the object's type library and loads the object properties on the fly.
19:
You have to check the control's AllowToolTip property. If the AllowTooltip property is False the control doesn't enable the tooltip feature. By default, the control's tooltip feature is disabled.
20:
The Property object provides two new properties Mask and MaskChar, which allow you to use masked editing in the control. The Mask property lets you define an input pattern containing literals and rules that filter characters during data entry. It consists of a combination of regular characters, literal escape characters, and masking characters. It can also include alternative characters and range rules. A literal escape character is preceded by a backslash (\) and is used to display a character that would otherwise be interpreted as part of a masking rule.

The following table lists all the supported masking characters and rules:

# ( Digit - masks a digit character [0-9]); 
x ( Lower Hexa - masks a lower hexa character. [0-9],[a-f]); 
X ( Upper Hexa - masks an upper hexa character. [0-9],[A-F]); 
A (AlphaNumeric - masks a letter or a digit. [0-9], [a-z], [A-Z]); 
? ( Alphabetic - masks a letter. [a-z],[A-Z] ); 
< ( Lower Alphabetic - masks a lower letter. [a-z] ); 
> ( Upper Alpabetic - masks an upper letter [A-Z] ); 
* ( Any - mask any combination of characters ); 
\ ( Literal escape - Displays any masking characters: \#,\x,\X,\A,\?,\<,\>,\\,\{,\[ ); 
{nMin,nMax} ( Range - masks a number in a range ); 
[] ( Alternative - masks any characters that are contained by brackets []. For instance, the [abcA-C] masks any character: a,b,c,A,B,C

The following VB sample shows how to mask a telephone number:

PropertiesList1.Property("Telephone" ).Mask = "+40 (###) - ### ####".

The following VB sample shows how to mask an IP address:

PropertiesList1.Property("IP Address" ).Mask = "{0,255}.{0,255}.{0,255}.{0,255}".
You have to use the MaskChar in order to change the masking character. By default the '_' character is used to mask characters.
21:
Here's a snippet of VB code that helps you to delete the picture object when user presses the Delete key.
Private Sub PropertiesList1_KeyPress(KeyAscii As Integer, Shift As Integer)
    On Error Resume Next
    If (KeyAscii = vbKeyDelete) Then
        With PropertiesList1
            If Not (.SelectedProperty.Value Is Nothing) Then
                If TypeOf .SelectedProperty.Value Is IPictureDisp Then
                    .SelectedProperty.Value = Nothing
                    .Refresh
                End If
            End If
        End With
    End If
End Sub
22:
Yes, that's possible. You need to use the Add method and EditObject type like in the following sample:
With PropertiesList1
        .BeginUpdate
            .Add "From", Me, EditObject
            .Add "PropertiesList", PropertiesList1, EditObject
        .EndUpdate
End With
The "From"  item will include all properties of the form object ( me ), and the PropertiesList item includes the properties of the PropertiesList1 object.
23:
The SelectedProperty property allows you to retrieve the currently selected property or change the selection to another property.

The following VB sample shows how to select the property called "Appearance":

PropertiesList1.SelectedProperty = PropertiesList1.Property("Appearance")
24:
Yes, the Exontrol ExPrint component ( exprint.dll ) provides Print and Print Preview capabilities for the exPropertiesLisy component. Once that you can have the exPrint component in your Components list, insert a new instance of "ExPrint 1.0 Control Library" to your form and add the following code:
Private Sub Command1_Click()
    With Print1
        Set .PrintExt = PropertiesList1.Object
        .Preview
    End With
End Sub

The Exontrol Print Preview mainframe looks like follows:

25:
The Exontrol ExPrint component ( exprint.dll ) provides Print and Print Preview capabilities for the Exontrol ExList component.

The requirements for the FitToPage option:

  • Exontrol.ExPrint version 5.2 ( or greater )
  • Exontrol.ExPropertiesList version 8.1 ( or greater )

If these are not meet, the Options("FitToPage") property has NO effect.

The FitToPage option could be one of the following:

  • On, (Fit-To-Page) the control's content is printed to a single page ( version 6.1 )
  • p%, (Adjust-To) where p is a positive number that indicates the percent from normal size to adjust to. For instance, the "FitToPage = 50%" adjusts the control's content to 50% from normal size. ( version 8.1 )
  • w x, (Fit-To Wide) where w is a positive number that indicates that the control's content fits w pages wide by how many pages tall are required. For instance, "FitToPage = 3 x" fits the control's content to 3 pages wide by how many pages tall is are required. ( version 8.1 )
  • x t, (Fit-To Tall) where t is a positive number that specifies that the control's content fits t pages tall by how many pages wide are required. For instance, "FitToPage = x 2" fits the control's content to 2 pages tall by how many pages wide are required. ( version 8.1 )
  • w x t, (Fit-To) where w and t are positive numbers that specifies that the control's content fits w pages wide by t pages tall. For instance, "FitToPage = 3 x 2" fits the control's content to 3 pages wide by 2 pages tall. ( version 8.1 )

The following VB6 sample shows how to show the ExProperties/COM's content to one page when print or print preview the component:

Private Sub Command1_Click()
    With Print1
        .Options = "FitToPage = On"
        Set .PrintExt = PropertiesList1.Object
        .Preview
    End With
End Sub

The following VB/NET sample shows how to show the ExPropertiesList/NET's content to one page when print or print preview the component:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    With Exprint1
        .Options = "FitToPage = On"
        .PrintExt = Expropertieslist1
        .Preview()
    End With
End Sub
26:
The Description property of Property object specifies the selected property's description. Use the Property property to access a Property by its name or its identifier. Use the DescriptionVisible property to show the control's description panel.
27:
The ToolTip property of the Property object  allows you to specify a custom tooltip to the property. The tooltip pops up if the AllowToolTip property is True, and the mouse pointer is over the property's name.

The following sample assign a tooltip to a property:

With PropertiesList1
    .AllowTooltip = True
    With .Add("Border", True, EditBoolean)
        .ToolTip = "Specifies whether the object displays a border."
    End With
End With
28:
The NumericFloat property allows you to enter a property of float type. The format of the number could be like follows [+/-]digit[.]digit[e/E/d/D][+/-]digit, where digit is any combination of digit characters. If the NumericFloat property is True, the control filters the input characters that have no sense in the format of the number.
29:
Set the ShowObjects property on False, before adding new properties using the Add method. It has no effect if you are using the Select method.
30:
Use the AutoIndent property on False.
31:
Use the Option property to customize a specified editor. The following sample customizes the EditDate editor to display strings in Romanian language:

The following sample customizes the EditDate editor to display strings in Romanian language:

With PropertiesList1
    .Option(exDateTodayCaption) = "Azi"
    .Option(exDateMonths) = "Ianuarie Februarie Martie Aprilie Mai Iunie Iulie August Septembrie Octombrie Decembrie"
    .Option(exDateWeekDays) = "D L M M J V S"
    .Option(exDateFirstWeekDay) = 1
    .Add "Date", Date, EditDate
End With
32:
Set the ShowItemsCollection property on False. The Me object exposes a collection of controls that displays in the form, and also it exports a property for each control in the collection, that's why the PropertiesList1 object is listed twice.
33:
The ExPropertiesList control provides a Select method that allows you to browse the properties of an object. You can use this method to select or browse the properties of any COM object, including ActiveX controls.

The following VB sample shows you how you can browse the properties of the Microsoft's ListBox ActiveX control:

Private Sub Form_Load()
    Set l = Controls.Add("Forms.ListBox.1", "list1")
    l.Visible = True
    PropertiesList1.Select l
End Sub
34:
The Select method browses the properties of the specified object, loading their names and current values into the ExPropertiesList control. Whenever the user changes a property in the ExPropertiesList control, the corresponding property of the specified object is updated. The ExPropertiesList control fires the PropertyChanged event to notify the application that a property has been changed. The following sample uses the browser's Template and TemplateDef properties to change the object's properties at runtime. It also uses the DisplayCaption property to retrieve the name of each property to be serialized in the Template format.

The following VB sample builds a string with the properties/values the user changes:

Private sChanged As String

Private Sub PropertiesList1_PropertyChanged(ByVal Property As EXPROPERTIESLISTLibCtl.IProperty)
    With Property
        Dim sQuote As String
        If (.Type = "BSTR") Then
            sQuote = """"
        End If
        sChanged = sChanged + .DisplayCaption(exDisplayTemplate) & " = " & sQuote & .Value & sQuote & vbCrLf
    End With
End Sub

The sample builds strings as follows:

BackColor = 65535
Columns("B").Def(4) = 255
SortBarVisible = True

Now, all you need to do is apply these strings to your object.

The following VB sample shows how to apply the changed properties to your object:

Private Sub ApplyTemplateTo(ByVal o As Object, ByVal sTemplate As String)
    With PropertiesList1
        .TemplateDef = "Dim obj"                ' Allocates a member variable called obj
        .TemplateDef = o                        ' Assigns a value to the variable obj, in this case your object
        .Template = "obj{" & sTemplate & "}"    ' Applies the giving template ( sTemplate ) to obj, in this case your object
    End With
End Sub

The sample uses the TemplateDef property to allocate a member variable named obj, which holds a reference to your object, and executes the object's code (X-Script or Template code).

In short, all you need to do is save the sChanged string to a file and load it whenever needed, then pass it to the ApplyTemplateTo method to apply the changed properties to your object. You can further optimize the code so that the sChanged string (Template code) contains only one line per property. Currently, each change made in the browser is appended as a new line to the sChanged string, so the same property may occur multiple times with different values. For instance, you can use a hash table to store each property's name and value, ensuring that the resulting string contains no duplicate entries for the same property.

How-To Questions
FAQ