viksoe.dk

PropertyView control

PropertyView control

The WTL PropertyView control is a custom drawn LISTBOX Windows control, which displays a property list. The control is not in-place editable, so all the property values are read-only.

To use it, place a listbox control on your dialog.
Add a member variable to your dialog implementation file...

CPropertyView m_ctlList
In the OnInitDialog() event handler, add the following line:
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lP...
{
  ...
  m_ctlList.SubclassWindow(GetDlgItem(IDC_MYLISTBOX));
  ...
}

The control must have the LBS_OWNERDRAWVARIABLE flag set so it can draw its own items. In addition the flags LBS_SORT and LBS_HASSTRINGS are removed, because they would interfere with the drawing.

Source Code Dependencies

Microsoft Visual C++ 6.0
Microsoft WTL 3.0 Library

See Also

Sample application, where the control is used
My more advanced Property List control

Download Files

DownloadSource Code (4 Kb)


Written by Bjarke Viksoe.
Article submitted 6/7/2001.