|
|
PropertyGrid control
A grid control is similar to a normal list control, except that each sub-item is editable. Sub-items can contain text values (for editing), dropdown lists, filename browsers or pretty much any type imaginable.
Just as my other property controls (the PropertyList and PropertyTree controls),
it's using the same selection of in-place editors, ranging from dropdown lists to filename browsers.
They are all implemented as standard windows, which link to the parent control through a generic
interface and some shared window messages.
Because of this design, you may extend the control with your own property types.
The nice thing about this grid control is that it uses the same navigation as a normal spreadsheet grid, and that it has many familiar keyboard-shortcuts (F2 key and space works as expected). It doesn't do sofisticated row/column selection or copy/paste functionality, but for a fast type-in grid control it's very nice. How to use itPlace aListView control on a dialog.
Add a member variable to your dialog class...
In the OnInitDialog() event handler, add the following line:
Then add the following reflection macro to your main message map:
Here are some of the control methods available:
and several of the original CListViewCtrl methods still work as well.
Just like the
Once you have added your column headers, you cannot add or delete them again.
Adding a new property requires using a "creation helper" method...
Note how the Name argument (1st argument) is empty for the creation helper routines
since properties in this control do not have an attached label.
You may also associate some item-data to each property using the SetItemData() method,
so it can later be identified.
The PropertyList control sample explains how to use some of the other editors.
Several notifications are sent back to the owner window.
They contain information about the changing property using
In addition, all of the original ListView notifications are also
available. Use the GetSelectedIndex() and GetSelectedColumn()
methods to located the selected property.
Source Code DependenciesMicrosoft Visual C++ 6.0Microsoft WTL 3.1 Library See AlsoMy Property List controlMy Property Tree control My ChoiceBar control for adding your own pop-ups Download Files
Written by Bjarke Viksoe. Article submitted 1/26/2002. To the top
|
|||