method PropertiesList.Select (Object as Object)

Browses a new object to control.

TypeDescription
Object as Object An Object being browsed.

Use the Select method to browse the properties of a COM object. Use the SelectedObject property to browse properties of .NET objects ( objects in the .NET framework ). If the FireIncludeProperty is True, the Select method invokes the IncludeProperty event to let user filters the properties being browsed. Use the Add method to insert custom entries to the list. 

The following VB sample browses the properties of the object itself ( including the properties of the extended control, Visible, Top, and so on ):

PropertiesList1.Select PropertiesList1

The following VB sample browses only the properties of the object itself:

PropertiesList1.Select PropertiesList1.Object

The following C++ sample browses the control's properties:

IDispatch* pObject = NULL;
if ( SUCCEEDED( m_propertieslist.GetControlUnknown()->QueryInterface( IID_IDispatch, (LPVOID*)&pObject ) ) )
{
	m_propertieslist.Select( pObject );
	pObject->Release();
}

In case you are using ATL ( atlbase.h ) classes you can use a code like follows:

CComQIPtr<IDispatch> spObject( m_propertieslist.GetControlUnknown() );
m_propertieslist.Select( spObject );

The following VB.NET sample browses the control's properties:

AxPropertiesList1.CtlSelect(AxPropertiesList1.GetOcx()) 

The following C# sample browses the control's properties:

axPropertiesList1.CtlSelect( axPropertiesList1.GetOcx() );

The following VFP sample browses the control's properties:

with thisform.PropertiesList1
	.Select(.Object)
endwith

If the Select method is called, and you need immediately after the list of browsed properties the following trick is required:

Private Type POINTAPI
        x As Long
        y As Long
End Type

Private Type MSG
    hwnd As Long
    message As Long
    wParam As Long
    lParam As Long
    time As Long
    pt As POINTAPI
End Type
Private Declare Function PeekMessage Lib "user32" Alias "PeekMessageA" (lpMsg As MSG, ByVal hwnd As Long, ByVal wMsgFilterMin As Long, ByVal wMsgFilterMax As Long, ByVal wRemoveMsg As Long) As Long
Private Const PM_NOREMOVE = &H0
Private Declare Function TranslateMessage Lib "user32" (lpMsg As MSG) As Long
Private Declare Function DispatchMessage Lib "user32" Alias "DispatchMessageA" (lpMsg As MSG) As Long

' The list of properties is not immediately available, so we need to proceeds few messages
Private Sub waitSelect(ByVal h As Long)
    Dim m As MSG
    While PeekMessage(m, h, 0, 0, 1)
        TranslateMessage m
        DispatchMessage m
    Wend
End Sub

The following sample uses the trick, to expand the "Appearance" item:

Private Sub Form_Load()
    With PropertiesList1
        .BeginUpdate
            .HasLines = False
            .ShowCategories = True
            .MarkCategories = True
            .Select PropertiesList1.Object
            
            waitSelect .hwnd
            
            .ExpandItem("Appearance") = False
        .EndUpdate
    End With
End Sub

Note that if the waitSelect method is not called, the "Appearance" item is still expanded.

In VC++ the waitSelect method looks like follows:

// Function name	: waitSelect
// Description	: The list of properties is not immediately available, so we need to proceeds few messages
// Return type	: void 
// Argument         	: HWND h
void waitSelect( HWND h )
{
	MSG m = {0};
	while ( PeekMessage( &m, h, 0, 0, PM_REMOVE ) )
	{
		TranslateMessage( &m );
		DispatchMessage( &m );
	}
}

The following VB sample browses the Form contains that hosts the ExPropertiesList control: 

PropertiesList1.Select Me

The following VB sample clears the browsed object: 

PropertiesList1.Select Nothing

The following VB sample browses an object and its categories:

Private Sub Form_Load()
    With PropertiesList1
        .BeginUpdate
            .HasLines = False
            .ShowCategories = True
            .MarkCategories = True
            .Select PropertiesList1.Object
        .EndUpdate
    End With
End Sub