Desktop-as-a-Service Designed for Any Cloud ? Nutanix Frame

 Download Source Code and Example (45k)

Special note:Thanks goes to Keith Rule for the CMemDC class which is used in the code.

In some of the applications I have developed, there has been a need for user creatable options and for the integration of new object types into an application without changing the application code. This presents a problem when the new objects do not share all of the properties of the previous objects. Visual Basic, MS Access and many other applictions handle this problem through a property list type interface (as shown above.)

I looked for a control to do this, but did not find one that I thought was all that great. So, I wrote my own. This is the result.

This control is a CWnd derived class. It's public interface is similar to the CListCtrl and other MFC control classes. Functions are provided for adding items, removing items and accessing the settings for items.

I think it should be fairly easy to implement into other projects without too much work. I have put together the sample application to demonstrate how to use it.

How it works:

The CFPSPropertyList class contains a list of CFPSPropertyListItems. These items implement the actual item draw/selection functionality. Items are drawn Top Down and Scroll support is provided.

The CFPSPropertyListItem class implements functions for the properties listed below. A message (FPS_PROPLIST_ITEM_CHANGED) is sent to the parent window whenever a property item changes the wParam member contains the item ID.

Edit Boxes/Combo Boxes are only created when needed and are destroyed as soon as is reasonble. Text (and colors) are drawn using standard CDC functions (not throught CEdit, CComboBox classes)

When the user sizes the window, the contents are automatically resized in the same way that VB does.

Property item types supported:

  • Text (Edit Box)
  • Combo (Combo Box)
  • Numbers - Long and Integer (Edit Box)
  • Font (CFontDialog)
  • Color (CColorDialog)
  • File (CFileDialog)
  • BOOLEAN (Toggle)

How to use the control:

  1. Allocate a CFPSPropertyList object
  2. Call one of the 2 ::Create functions for the class
  3. Add items to the list using the AddItem functions (3 Versions provided)
  4. ShowWindow(TRUE);

How to set item values:

Several SetItemValue functions are provided for setting the values for individual property list items.

How to get item values:

Several GetItemValue functions are provided for retrieving values from individual property list items.

Additional Control:

Individual CFPSPropertyListItem entries can be accessed through MFC style list functions. These are
  • GetFirstItemPosition
  • GetNextItem
  • GetItemCount

Things to Improve:

If new property types are required, they can either be added to the CFPSPropertyListItem class or a class can be derived from CFPSPropertyListItem to implement new features.

Known Issues:

The scroll bar THUMB positioning mechanism is not implemented.

Last updated: 26 July 1998


  • One small correction...

    Posted by Legacy on 12/24/1998 08:00am

    Originally posted by: Warren Marshall

    If you add the line...


    ...at the bottom of the "CFPSPropertyListItem::DisplayEditBox" function, you can make it so you only have to click once to edit a text box, instead of twice like you do now.

    Otherwise, this is a great control! Just what I was looking for. I was 10 minutes away from writing one of my own, and I thought "well, might as well check codeguru. Maybe someone has made something similar to what I want."

    Heh, no. Someone has made EXACTLY what I want. :)

    Thanks again!


  • Property List and Property List Demo

    Posted by Legacy on 11/18/1998 08:00am

    Originally posted by: Vince Blasberg

    Subject: Property List and Property List Demo

    Love it!!

    "m_nPropList.Invalidate();" helped the scroll feature and an immediate update of SetItemValue(..);

    Needed to clear the list with "ItemInfo.ComboBoxList.RemoveAll();" before setting up another combo box type otherwise each subsequent combo will have more and more...

    Changed the Boolean types to the standard "True" and "False" and set them in an additional DblClick and pulled them out of the click event for more standard interaction.

    Love it!!

    Thanks as Usual
    Vince Blasberg
    Symon Communications

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date