FAQ (expropertieslist)
Exontrol.COM Software - Frequently Asked Questions - ExPropertiesList Component
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 the following ways to add new items to the control:

The Add method allows adding new items to the control. The following 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 sample adds items as a simple tree:
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 ( C++: an object that exposes the IDispatch implementation, VB: any Object, Class implements the IDispatch interface ), and you want to display its properties in the control you have to use the Select method. For instance the following sample browses the properties of the Form object:
PropertiesList1.Select Me 

The following 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 sample shows how to browse only the fields of the recordset ( Please noticed that this time the rs is declared as global, because ShowReadOnly property requires it as global )

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 are writing your own classes in VB environment you will be able to browse them as well using the control like in the following sample. Let's suppose that we have the following class 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 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 doesn't notify the control that the used font has been changed, so calling PropertiesList1.Font.Name = "Arial Unicode MS" has effect only for the control's drop-down window, but it doesn't change the font for control inside text editors. Remember that Font is a system object, and it is not implemented by the control, so that's the reason why the control is not notified that the user has changed the font's name. The following sample changes the font used by inside text editors as well for the drop-down window:
Dim f As New StdFont
f.Name = "Arial Unicode MS"
PropertiesList1.Font = f
10:
The control exposes an Interfaces property  ( it is hidden and your VB context window will not display it ) that allows you to get the list of implemented interfaces. The following sample displays the list of interfaces implemented by a Form object:
Debug.Print PropertiesList1.Interfaces(Me)
11:
The following samples adds an Enum type property:
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 notice that the Refresh method was called after adding values to the predefined list. The Refresh method is required because when the property is added the list of predefined values is unknown, since they've been added  later.
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:
Yes. The following sample helps you to make your control looks like in the .NET environment:
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:
Yes. The Property object provides two new properties Mask and MaskChar that helps you to use masked edit in the control. You can use the Mask to enter any data that includes literals and requires a mask to filter characters during data input. The Mask property is composed by a combination of regular characters, literal escape characters, and masking characters. The Mask property can contain also alternative characters, or range rules. A literal escape character is preceded by a \ character, and it is used to display a character that is used in masking rules. Here's the list of all rules and masking characters:

# ( 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 sample shows how to mask a telephone number

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

The following 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 of the control helps you to get the selected property as well as changing the selected property as follows:
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 following 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 properties of the giving object, which means it loads the properties with their values in the eXPropertiesList control. The control's property is changed as soon as the user changes the Property in the eXPropertiesList control. The eXPropertiesList control fires the PropertyChanged event when the user changes a Property in the browser control. The following sample uses the browser's Template/TemplateDef properties to change the properties of your object at runtime. Also it uses the DisplayCaption property to retrieve the name of the 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 like follows:

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

 Now, all we need is to apply this kind of strings to your object. Let's say your object is Object1 in the following sample, so the procedure will be:

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 allocates a member variable obj to holds a reference to your object, and executes the code (x-script, template code ) of this object.

Shortly, all you need is to save / load the sChanged string to a file, and pass it so ApplyTemplateTo method whenever you need to apply the changed properties to your object. You can optimize the code, so the sChanged ( Template code ) holds just a line with a specified property, as currently, any change in the browser is saved to a new line to the sChanged string, so multiple values for the same property may occurs. For instance, you can use a hash table to store the property's name and value, and so, lines will not save multiple values for the same property.

How-To Questions
General Questions