Introduction
This control is an implementation of a Delphi/VB/VS.NET - Style
Object-Inspector. I use this control in many of my applications' property pages
to let the user quickly change application settings. I've tried to keep things
as simple as possible, although usage of this control may look a bit strange at
first sight - the interfaces of the control doesn't resemble the interfaces of
other MFC controls, since it's intended to be special purpose control for
changing properties only.
The documentation is sparse, because I do not have much time to write
documentation. However, the included demo is hopefully a help in understanding
how to use the features of the control.
Features
The control supports many build-in property types (although adding your own
propery-types should be no problem) :
bool
short
int
float
double
CString
CStringList
COLORREF
COleDateTime
Usage
To use this control in your own application, add CObjectInspector.cpp,
CColorButton.cpp and CColourPopup.cpp to your project file. Open the resource
editor and place a custom control on your dialog. In the control's properties
enter "ObjectInspectorCtrl" as window-classname. Add a
CObjectInspector
variable to your dialog class :
CObjectInspector m_OI;
Add a DDX_Control handler to your DoDataExchange function :
void CMyDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_OI, m_OI);
}
Override OnInitDialog to customize the Object-Inspector and to add groups
and properties :
BOOL CMyDialog::OnInitDialog()
{
CDialog::OnInitDialog();
CObjectInspector::CProperty *pGroup;
m_OI.AddProperty (pProp = new CObjectInspector::CProperty("Group"));
pProp->AddProperty (new CObjectInspector::CProperty("Integer-Value", &m_nIntValue));
pProp->AddProperty (new CObjectInspector::CProperty("Bool Value", &m_bBoolVal));
}
Override OnNotify
to receive notification messages from the
control :
BOOL CMyDialog::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
if (wParam == IDC_OI)
{
CObjectInspector::NM_OIVIEW *nmHdr = (CObjectInspector::NM_OIVIEW*) lParam;
if (nmHdr->hdr.code == OIVN_ITEMCHANGED)
{
}
if (nmHdr->hdr.code == OIVN_ITEMCHANGING)
{
}
}
return CDialog::OnNotify(wParam, lParam, pResult);
}
Known issues
Navigation with the cursor keys is quite unsatisfactorily.
Acknowledgments
- Chris Maunder for his color picker
- Keith Rule for his Memory DC class
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.