Click here to Skip to main content
13,252,362 members (56,241 online)
Click here to Skip to main content
Add your own
alternative version


38 bookmarked
Posted 4 Aug 2001

Delphi/VB/VS.NET-style ObjectInspector Control

, 4 Aug 2001
Rate this:
Please Sign up or sign in to vote.
A Delphi-Style Object Inspector
<!-- Download Links -->

Sample Image #1 Sample Image #2


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.


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
  • COleDateTime


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)
	DDX_Control(pDX, IDC_OI, m_OI);

Override OnInitDialog to customize the Object-Inspector and to add groups and properties :

BOOL CMyDialog::OnInitDialog()

	CObjectInspector::CProperty *pGroup;
	// Create new property group
	m_OI.AddProperty (pProp = new CObjectInspector::CProperty("Group"));

	// Add properties to the 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;

       // OIVN_ITEMCHANGED is sent after the user has changed a property
       if (nmHdr->hdr.code == OIVN_ITEMCHANGED)
           // Do some stuff (use nmHdr->pProperty to access the altered property)

       // OIVN_ITEMCHANGING is sent when the user is currently editing a property
       if (nmHdr->hdr.code == OIVN_ITEMCHANGING)
           // Do some stuff (use nmHdr->pProperty to access the currently edited property)
    return CDialog::OnNotify(wParam, lParam, pResult);

Known issues

Navigation with the cursor keys is quite unsatisfactorily.


  • Chris Maunder for his color picker
  • Keith Rule for his Memory DC class


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Gunnar Bolle
Web Developer
Germany Germany
No Biography provided

You may also be interested in...


Comments and Discussions

GeneralRemaining Errors that Need to be Fixed.... Pin
chris17529-Apr-06 7:09
memberchris17529-Apr-06 7:09 
1. Open a list with lots of items. Make sure there is enough to have a scroll bar. Now close all the items to make the scroll bar disappear. When the scroll bar disappears there is a white line remaining from the boarder of the scroll bar through all the controls.
2. Make two drop down sections and put some items in each drop down. Select the first control in the first dropdown. (make sure the control is in edit mode under the value column) Then close the first drop down section. For some reason the value column cell next to the second drop down doesn't have the right color.
3. Create a color control and below that another color control. Now change the first color control with to a different color. When the color control closes the 2nd color control disappears until the user clicks somewhere?

GeneralFix: Entering in negative values for Shorts and Integers Pin
chris17521-Apr-06 7:24
memberchris17521-Apr-06 7:24 
GeneralFix: Entering in negative values for Floats and Doubles Pin
chris17521-Apr-06 7:07
memberchris17521-Apr-06 7:07 
QuestionHow to change the Scroll Amount Pin
chris17521-Apr-06 7:02
memberchris17521-Apr-06 7:02 
GeneralColor Popup Flaw... Pin
chris17521-Apr-06 6:59
memberchris17521-Apr-06 6:59 
GeneralChange This to Fix Check Button Pin
chris17519-Apr-06 4:39
memberchris17519-Apr-06 4:39 
GeneralUse this to update data after closing control Pin
chris17519-Apr-06 2:51
memberchris17519-Apr-06 2:51 
GeneralBug in CalculateScrollRange Pin
Einstand16-Aug-05 0:13
memberEinstand16-Aug-05 0:13 
GeneralBug reports part 2. - The Fixes Pin
Yogurt11-Aug-03 4:37
memberYogurt11-Aug-03 4:37 
GeneralBug reports (even if the author doesn't update this article...) Pin
Yogurt11-Aug-03 3:24
memberYogurt11-Aug-03 3:24 
Generalsmall bug Pin
Daniel Harth6-Jun-03 3:38
sussDaniel Harth6-Jun-03 3:38 
QuestionUpdate? Pin
hero3blade26-May-03 17:31
memberhero3blade26-May-03 17:31 
GeneralDelete Property - Dynamic Pin
Anonymous3-Aug-02 0:50
sussAnonymous3-Aug-02 0:50 
GeneralSomething wrong with the link. Pin
Anonymous26-Sep-01 0:24
memberAnonymous26-Sep-01 0:24 
GeneralWin95 problems Pin
Anonymous6-Aug-01 10:41
memberAnonymous6-Aug-01 10:41 
QuestionBroken link?? Pin
Anonymous6-Aug-01 10:15
memberAnonymous6-Aug-01 10:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.171114.1 | Last Updated 5 Aug 2001
Article Copyright 2001 by Gunnar Bolle
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid