description | title | ms.date | f1_keywords | helpviewer_keywords | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Learn more about: CMFCPropertyGridProperty class |
CMFCPropertyGridProperty class |
10/12/2022 |
|
|
A CMFCPropertyGridProperty
object represents a list item in a property list control.
For more detail, see the source code located in the mfc
folder of your Visual Studio installation. For example, %ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\atlmfc\src\mfc
.
class CMFCPropertyGridProperty : public CObject
Name | Description |
---|---|
CMFCPropertyGridProperty::CMFCPropertyGridProperty |
Constructs a CMFCPropertyGridProperty object. |
CMFCPropertyGridProperty::~CMFCPropertyGridProperty |
Destructor. |
Name | Description |
---|---|
CMFCPropertyGridProperty::AddOption |
Adds a new list item to a property list control. |
CMFCPropertyGridProperty::AddSubItem |
Adds a child item to a property. |
CMFCPropertyGridProperty::AdjustButtonRect |
Called by the parent property list control to tell a property to resize the bounding rectangle of an embedded button. |
CMFCPropertyGridProperty::AdjustInPlaceEditRect |
Retrieves the boundaries of the text box and optional spin button control that are used to set a property value. |
CMFCPropertyGridProperty::AllowEdit |
Makes a property either editable or read-only. |
CMFCPropertyGridProperty::CreateInPlaceEdit |
Called by the framework to create an editable control for a property. |
CMFCPropertyGridProperty::CreateSpinControl |
Called by the framework to create an editable spin button control. |
CMFCPropertyGridProperty::Enable |
Enables or disables a property. |
CMFCPropertyGridProperty::EnableSpinControl |
Enables or disables a spin button control that is used to modify a property value. |
CMFCPropertyGridProperty::Expand |
Expands or collapses a property that contains subproperties. |
CMFCPropertyGridProperty::FormatProperty |
Formats the text representation of a property value. |
CMFCPropertyGridProperty::GetData |
Retrieves a DWORD value that is associated with a property. |
CMFCPropertyGridProperty::GetDescription |
Retrieves a property description. |
CMFCPropertyGridProperty::GetExpandedSubItems |
Retrieves the number of expanded subitems. |
CMFCPropertyGridProperty::GetHierarchyLevel |
Retrieves the zero-based index of the property's hierarchy level. |
CMFCPropertyGridProperty::GetName |
Retrieves the name of the property. |
CMFCPropertyGridProperty::GetNameTooltip |
Called by the framework to display the name of the property in a tooltip. |
CMFCPropertyGridProperty::GetOption |
Retrieves the text of the option that is specified by an index. |
CMFCPropertyGridProperty::GetOptionCount |
Retrieves the number of options that belong to a property. |
CMFCPropertyGridProperty::GetOriginalValue |
Retrieves the initial value of the current property. |
CMFCPropertyGridProperty::GetParent |
Retrieves a pointer to a parent property. |
CMFCPropertyGridProperty::GetRect |
Retrieves the bounding rectangle of a property. |
CMFCPropertyGridProperty::GetSubItem |
Retrieves a subproperty identified by a zero-based index. |
CMFCPropertyGridProperty::GetSubItemsCount |
Retrieves the number of subitems. |
CMFCPropertyGridProperty::GetThisClass |
Used by the framework to obtain a pointer to the CRuntimeClass object that is associated with this class type. |
CMFCPropertyGridProperty::GetValue |
Retrieves a property value. |
CMFCPropertyGridProperty::GetValueTooltip |
Called by the framework to retrieve the text representation of the property value that is then displayed in a tooltip. |
CMFCPropertyGridProperty::HitTest |
Points to the property object that corresponds to the property list item that corresponds to a point. |
CMFCPropertyGridProperty::IsAllowEdit |
Indicates whether a property is editable. |
CMFCPropertyGridProperty::IsEnabled |
Indicates whether a property is enabled or disabled. |
CMFCPropertyGridProperty::IsExpanded |
Indicates whether a property is expanded or collapsed. |
CMFCPropertyGridProperty::IsGroup |
Indicates whether the current property represents a group. |
CMFCPropertyGridProperty::IsInPlaceEditing |
Indicates whether the current property is editable. |
CMFCPropertyGridProperty::IsModified |
Indicates whether the current property is modified. |
CMFCPropertyGridProperty::IsParentExpanded |
Indicates whether the parents of the current property are expanded. |
CMFCPropertyGridProperty::IsSelected |
Indicates whether the current property is selected. |
CMFCPropertyGridProperty::IsVisible |
Indicates whether the current property is visible. |
CMFCPropertyGridProperty::OnClickButton |
Called by the framework when the user selects a button that is contained in a property. |
CMFCPropertyGridProperty::OnClickName |
Called by a parent property list control when a user selects the name field of a property. |
CMFCPropertyGridProperty::OnClickValue |
Called by a parent property list control when a user selects the value field of a property. |
CMFCPropertyGridProperty::OnCloseCombo |
Called by the framework when a combo box that is contained in a property is closed. |
CMFCPropertyGridProperty::OnDblClk |
Called by the framework when the user double clicks a property. |
CMFCPropertyGridProperty::OnDrawButton |
Called by the framework to draw a button that is contained in a property. |
CMFCPropertyGridProperty::OnDrawDescription |
Called by the framework to display the property description. |
CMFCPropertyGridProperty::OnDrawExpandBox |
Called by the framework to draw an expand box control near a property that contains subproperties. |
CMFCPropertyGridProperty::OnDrawName |
Called by the framework to display the property name. |
CMFCPropertyGridProperty::OnDrawValue |
Called by the framework to display the property value. |
CMFCPropertyGridProperty::OnEdit |
Called by the framework when the user is about to modify a property value. |
CMFCPropertyGridProperty::OnEndEdit |
Called by the framework when the user is finished modifying a property value. |
CMFCPropertyGridProperty::OnKillSelection |
|
CMFCPropertyGridProperty::OnPosSizeChanged |
|
CMFCPropertyGridProperty::OnRClickName |
Called by the framework when the user selects the right mouse button in the property name area. |
CMFCPropertyGridProperty::OnRClickValue |
Called by the framework when the user selects the right mouse button in the property value area. |
CMFCPropertyGridProperty::OnSelectCombo |
Called by the framework when the user selects an item from the editable combo box. |
CMFCPropertyGridProperty::OnSetCursor |
Called by the framework when the mouse pointer moves to a property item. |
CMFCPropertyGridProperty::OnSetSelection |
|
CMFCPropertyGridProperty::OnUpdateValue |
Called by the framework when the value of an editable property has changed. |
CMFCPropertyGridProperty::PushChar |
Called from the property list control when the property is selected and the user enters a new character. |
CMFCPropertyGridProperty::Redraw |
Redraws the property. |
CMFCPropertyGridProperty::RemoveAllOptions |
Removes all options (items) from a property. |
CMFCPropertyGridProperty::RemoveSubItem |
Removes the specified subitem. |
CMFCPropertyGridProperty::ResetOriginalValue |
Restores the original value of an edited property. |
CMFCPropertyGridProperty::SetData |
Associates a DWORD value with a property. |
CMFCPropertyGridProperty::SetDescription |
Specifies the text that describes the current property. |
CMFCPropertyGridProperty::SetName |
Sets the name of a property. |
CMFCPropertyGridProperty::SetOriginalValue |
Sets the original value of an editable property. |
CMFCPropertyGridProperty::SetValue |
Sets the value of a property grid property. |
CMFCPropertyGridProperty::Show |
Shows or hides a property. |
Name | Description |
---|---|
CMFCPropertyGridProperty::CreateCombo |
Called by the framework to add a combo box to a property. |
CMFCPropertyGridProperty::HasButton |
Indicates whether a property contains a button. |
CMFCPropertyGridProperty::Init |
Called by the framework to initialize a property object. |
CMFCPropertyGridProperty::IsSubItem |
Indicates whether the specified property is a subitem of the current property. |
CMFCPropertyGridProperty::IsValueChanged |
Indicates whether the value of the current property has changed. |
CMFCPropertyGridProperty::OnCtlColor |
Called by the framework when it must retrieve a brush to fill the background color of a property. |
CMFCPropertyGridProperty::OnDestroyWindow |
Called by the framework when a property is destroyed or when editing is finished. |
CMFCPropertyGridProperty::OnKillFocus |
Called by the framework when the property loses the input focus. |
Name | Description |
---|---|
CMFCPropertyGridProperty::m_strFormatDouble |
Format string for a value of type double. |
CMFCPropertyGridProperty::m_strFormatFloat |
Format string for a value of type float. |
CMFCPropertyGridProperty::m_strFormatLong |
Format string for a value of type long. |
CMFCPropertyGridProperty::m_strFormatShort |
Format string for a value of type short. |
Use a CMFCPropertyGridProperty
object to represent a property, which you then add to a property list control. For more information, see CMFCPropertyGridCtrl
Class.
A property object can represent data types such as strings, dates, and Boolean or integer values. It can contain child properties, or it can contain a control such as a combo box or a button control.
The following example demonstrates how to construct a CMFCPropertyGridProperty
object. The example also demonstrates how to use various methods in the CMFCPropertyGridProperty
class to add an option, add a subitem, enable a property, and show a property. This example is part of the New Controls sample.
[!code-cppNVC_MFC_NewControls#27]
Header: afxpropertygridctrl.h
Adds a new list item to a property list control.
BOOL AddOption(
LPCTSTR lpszOption,
BOOL bInsertUnique=TRUE);
lpszOption
[in] The list item (option) to add.
bInsertUnique
[in] TRUE
to add the list item only if it doesn't already exist; otherwise, FALSE
. The default value is TRUE
.
TRUE
, which means that the list item is added. Otherwise, FALSE
, which means that the list item isn't added because the bInsertUnique
parameter is TRUE
and the list item specified by the lpszOption
parameter already exists.
Adds a child item to a property.
BOOL AddSubItem(CMFCPropertyGridProperty* pProp);
pProp
[in] Pointer to a property to add.
TRUE
if the specified property is successfully added as a child property. FALSE
if the property isn't added because it already occurs in the parent property.
Use this method to create a hierarchical list of parent and child properties. After a child property is added, the parent property automatically displays an expand box control that is designated by a plus sign (+). When the user selects the plus sign, the parent property expands and displays any child property items.
Called by the parent property list control to tell a property to resize the bounding rectangle of an embedded button.
virtual void AdjustButtonRect();
By default, this method:
- Adjusts the width of the button equal to the height of the button plus three pixels.
- Moves the bounding rectangle of the button to the right edge of the property.
- Shifts the button 1 pixel below the top edge of the property.
Retrieves the boundaries of the text box and optional spin button control that are used to set a property value.
virtual void AdjustInPlaceEditRect(
CRect& rectEdit,
CRect& rectSpin);
rectEdit
[out] When this method returns, a rectangle that specifies the boundaries of the text box for the property value.
rectSpin
[out] When this method returns, a rectangle that specifies the boundaries of the spin button control for the property value. Or, if the property doesn't support a spin button, an empty rectangle.
The value area of a property consists of a text box and possibly an option button, such as a spin button control. This method calculates the dimensions of the text box and option button and then returns those values in the specified parameters.
Makes a property either editable or read-only.
void AllowEdit(BOOL bAllow=TRUE);
bAllow
[in] TRUE
to make the property editable; FALSE
to make the property read-only. The default value is TRUE
.
Constructs a CMFCPropertyGridProperty
object.
CMFCPropertyGridProperty(
const CString& strGroupName,
DWORD_PTR dwData=0,
BOOL bIsValueList=FALSE);
CMFCPropertyGridProperty(
const CString& strName,
const _variant_t& varValue,
LPCTSTR lpszDescr=NULL,
DWORD_PTR dwData=0,
LPCTSTR lpszEditMask=NULL,
LPCTSTR lpszEditTemplate=NULL,
LPCTSTR lpszValidChars=NULL);
strGroupName
[in] The group name. A group is a collection of related properties in a property grid control. If the control is displayed hierarchically, the group name is displayed as a category title in the row above the group.
dwData
[in] Application-specific data, such as an integer or a pointer to other data that is associated with the property. The default value is 0.
strName
[in] The name of the property.
varValue
[in] The property value.
lpszDescr
[in] The property description. The default value is NULL
.
lpszEditMask
[in] The edit mask, if the property is a masked edit control. The default value is NULL
.
lpszEditTemplate
[in] The edit template, if the property is a masked edit control. The default value is NULL
.
lpszValidChars
[in] A list of valid characters, if the property is a masked edit control. The default value is NULL
.
bIsValueList
[in] TRUE
if the property represents a list of values; FALSE
if the property represents a single value. The default value is FALSE
.
Called by the framework to add a combo box to a property.
virtual CComboBox* CreateCombo(
CWnd* pWndParent,
CRect rect);
pWndParent
[in] Pointer to the parent window of the combo box.
rect
[in] The bounding rectangle of the combo box.
Pointer to a new CComboBox
object.
Called by the framework to create an editable control for a property.
virtual CWnd* CreateInPlaceEdit(
CRect rectEdit,
BOOL& bDefaultFormat);
rectEdit
[in] The bounding rectangle of the editable control.
bDefaultFormat
[in] TRUE
to use the default property format to set the text of the editable control; otherwise, FALSE
.
A pointer to the editable control if this method succeeds; otherwise, NULL
.
This method uses the values of the varValue
, lpszEditMask
, lpszEditTemplate
, and lpszValidChars
parameters that are specified in the CMFCPropertyGridProperty
class constructor. By default, this method supports the varValue
variant types. This includes VT_BSTR
, VT_R4
, VT_R8
, VT_UI1
, VT_I2
, VT_INT
, VT_UINT
, VT_I4
, VT_UI2
, VT_UI4
, and VT_BOOL
.
This method creates a CMFCMaskedEdit
control if one or more of the lpszEditMask
, lpszEditTemplate
, or lpszValidChars
parameters are specified; otherwise, it creates a CEdit
control.
Called by the framework to create an editable spin button control.
virtual CSpinButtonCtrl* CreateSpinControl(CRect rectSpin);
rectSpin
[in] A rectangle that defines where the editable spin button control is created.
A pointer to a new CMFCSpinButtonCtrl
object that is cast as a pointer to a CSpinButtonCtrl
object.
Call the CMFCPropertyGridProperty::EnableSpinControl
method to display an editable spin button control at the right edge of the property.
Enables or disables a property.
void Enable(BOOL bEnable=TRUE);
bEnable
[in] TRUE
to enable the property; FALSE
to disable the property. Disabled properties don't respond to mouse or keyboard input. The default value is TRUE
.
Enables or disables a spin button control that is used to modify a property value.
void EnableSpinControl(
BOOL bEnable=TRUE,
int nMin=0,
int nMax=0);
bEnable
[in] TRUE
to enable the spin button control; FALSE
to disable the spin button control. The default value is TRUE
.
nMin
[in] The minimum value of the spin button control. The default value is 0.
nMax
[in] The maximum value of the spin button control. The default value is 0.
The framework automatically creates a spin button control when a property is about to be edited.
The property type, which is specified by the varValue
parameter of the CMFCPropertyGridProperty::CMFCPropertyGridProperty
constructor, must be a supported variant type. Otherwise, this method asserts in debug mode. The supported types include VT_INT
, VT_UINT
, VT_I2
, VT_I4
, VT_UI2
, and VT_UI4
.
Expands or collapses a property that contains subproperties.
void Expand(BOOL bExpand=TRUE);
bExpand
[in] TRUE
to expand the property; FALSE
to collapse the property. The default value is TRUE
.
Formats the text representation of a property value.
virtual CString FormatProperty();
The text representation of the property value.
This method is called by the framework before the property value is displayed.
Retrieves a DWORD
value that is associated with a property.
DWORD_PTR GetData() const;
A DWORD
value.
The data that is returned is an application-specific value, such as a number or a pointer to other data. Specify the data value when you construct the property or when you call the CMFCPropertyGridProperty::SetData
method.
Retrieves a property description.
const CString& GetDescription() const;
A text string that contains the property description.
Property list control also uses this method to display the description of the property.
Retrieves the number of expanded subitems.
int GetExpandedSubItems(BOOL bIncludeHidden=TRUE) const;
bIncludeHidden
[in] TRUE
to include the hidden subitems in the count; otherwise, FALSE
. The default value is TRUE
.
The number of expanded subitems.
Retrieves the zero-based index of the property's hierarchy level.
int GetHierarchyLevel() const;
The property's hierarchical level.
Retrieves the name of the property.
LPCTSTR GetName() const;
Pointer to a string that contains the name of the property.
Called by the framework to display the name of the property in a tooltip.
virtual CString GetNameTooltip();
A string that contains the property name. By default, the return value is the empty string.
Retrieves the text of the option that is specified by an index.
LPCTSTR GetOption(int nIndex) const;
nIndex
The zero-based index of the property list item (option) to retrieve.
Pointer to a string that contains the option text.
Retrieves the number of options that belong to a property.
int GetOptionCount() const;
The number of property list items (options) that are contained in the property control.
Call the CMFCPropertyGridProperty::AddOption
method to add items to the property list. Call the CMFCPropertyGridProperty::RemoveAllOptions
method to remove all items.
Retrieves the initial value of the current property.
const COleVariant& GetOriginalValue() const;
The original value of the current property.
Use this method to undo the effect of an edit operation that changes the value of the current property.
The original value of the current property is set by the CMFCPropertyGridProperty::CMFCPropertyGridProperty
constructor, modified by the CMFCPropertyGridProperty::SetOriginalValue
method, and reset by the CMFCPropertyGridProperty::ResetOriginalValue
method.
Retrieves a pointer to a parent property.
CMFCPropertyGridProperty* GetParent() const;
A pointer to a parent property object, or NULL
for the top-level property.
Retrieves the bounding rectangle of a property.
CRect GetRect() const;
A CRect
object that describes the bounding rectangle.
Retrieves a subproperty identified by a zero-based index.
CMFCPropertyGridProperty* GetSubItem(int nIndex) const;
nIndex
[in] The zero-based index of the property to retrieve. This parameter is invalid if it's less than zero or greater than or equal to the number of subproperties.
A pointer to a property object that is a child item of this property.
-or-
In retail mode, NULL
if the nIndex
parameter is invalid. In debug mode, this method asserts.
Retrieves the number of subitems.
int GetSubItemsCount() const;
The number of child items.
Retrieves a property value.
virtual const _variant_t& GetValue() const;
A variant that contains the property value.
Called by the framework to retrieve the text representation of the property value that is then displayed in a tooltip.
virtual CString GetValueTooltip();
A CString
object containing the textual representation of the property value. By default, this value is the empty string.
Indicates whether a property contains a button.
virtual BOOL HasButton() const;
TRUE
if a property contains a button (or property list); otherwise, FALSE
.
Points to the property object that corresponds to the property list item that corresponds to a point.
CMFCPropertyGridProperty* HitTest(
CPoint point,
CMFCPropertyGridProperty::ClickArea* pnArea=NULL);
CMFCPropertyGridProperty* HitTest(
CPoint pt,
CMFCPropertyGridProperty::ClickArea* pnArea=NULL,
BOOL bPropsOnly=FALSE) const;
point
[in] The point to test, in client coordinates. This parameter is typically the current mouse pointer location.
pt
[in] The point to test, in client coordinates.
pnArea
[out] When this method returns, indicates the area that contains the specified point. For more information, see Remarks. The default value is NULL
.
bPropsOnly
[in] TRUE
to test any area in the property control; FALSE
to test only the description area. The default value is FALSE
.
A pointer to a property object or NULL
.
By default, this method tests property subitems if the specified point isn't found within any of the property items.
The following table lists the values that can be returned to the pnArea
parameter.
Area | Description |
---|---|
ClickArea::ClickExpandBox |
The expand box control, which is designated by a plus sign (+). |
ClickArea::ClickName |
The property name. |
ClickArea::ClickValue |
The property value. |
Called by the framework to initialize a property object.
void Init();
Indicates whether a property is editable.
BOOL IsAllowEdit() const;
TRUE
if the property is editable; otherwise FALSE
.
Indicates whether a property is enabled or disabled.
BOOL IsEnabled() const;
TRUE
if the property is enabled; FALSE
if the property is disabled.
Tells whether a property is enabled or disabled.
Indicates whether a property is expanded or collapsed.
BOOL IsExpanded() const;
TRUE
if the property is expanded; FALSE
if the property is collapsed.
Indicates whether the current property represents a group.
BOOL IsGroup() const;
TRUE
if the current property object represents a group; FALSE
if the property represents a value.
A group is a collection of related properties in a property grid control. If the control is displayed hierarchically, the group name is displayed as a category title in the row above the group.
Indicates whether the current property is editable.
BOOL IsInPlaceEditing() const;
TRUE
if the current property is editable; otherwise, FALSE
.
Indicates whether the current property is modified.
BOOL IsModified() const;
TRUE
if the property is modified; otherwise, FALSE
.
Indicates whether the parents of the current property are expanded.
BOOL IsParentExpanded() const;
TRUE
if all parents of the current property are expanded; FALSE
if the parent properties are collapsed.
Indicates whether the current property is selected.
virtual BOOL IsSelected() const;
TRUE
if the current property is selected; otherwise, FALSE
.
Indicates whether the specified property is a subitem of the current property.
BOOL IsSubItem(CMFCPropertyGridProperty* pProp) const;
pProp
[in] A pointer to a property.
TRUE
if the specified property is a subitem of the current property; otherwise, FALSE
.
Indicates whether the value of the current property has changed.
virtual BOOL IsValueChanged() const;
TRUE
if the value of the current property has changed; otherwise, FALSE
.
Indicates whether the current property is visible.
BOOL IsVisible() const;
TRUE
if the current property is visible; otherwise; FALSE
.
Holds a format string for a value of type double.
static CString m_strFormatDouble;
Holds a format string for a value of type float.
static CString m_strFormatFloat;
Holds a format string for a value of type long.
static CString m_strFormatLong;
Holds a format string for a value of type short.
static CString m_strFormatShort;
Called by the framework when the user selects a button that is contained in a property.
virtual void OnClickButton(CPoint point);
point
[in] A point, in client coordinates.
By default, this method does nothing.
Called by a parent property list control when a user selects the name field of a property.
virtual void OnClickName(CPoint C);
C
[in] A point, in client coordinates.
By default, this method does nothing.
Called by a parent property list control when a user selects the value field of a property.
virtual BOOL OnClickValue(
UINT uiMsg,
CPoint point);
uiMsg
[in] A mouse message.
point
[in] A point, in client coordinates.
TRUE
if the specified mouse message is processed by this method; otherwise, FALSE
.
By default, this method returns FALSE
if the current property isn't editable. Otherwise, the edit or spin control that is associated with this property processes the specified mouse message, and then this method returns TRUE
.
Called by the framework when a combo box that is contained in a property is closed.
virtual void OnCloseCombo();
Called by the framework when it must retrieve a brush to fill the background color of a property.
virtual HBRUSH OnCtlColor(
CDC* pDC,
UINT nCtlColor);
pDC
[in] Pointer to a device context.
nCtlColor
[in] (This parameter isn't used.)
The handle to a brush if this method is successful; otherwise, NULL
.
Called by the framework when the user double clicks a property.
virtual BOOL OnDblClk(CPoint point);
point
[in] A point, in client coordinates.
TRUE
if this method is successful; otherwise, FALSE
.
By default, this method selects the next property item in the property list control.
Called by the framework when a property is destroyed or when editing is finished.
virtual void OnDestroyWindow();
Called by the framework to draw a button that is contained in a property.
virtual void OnDrawButton(
CDC* pDC,
CRect rectButton);
pDC
[in] A pointer to a device context.
rectButton
[in] A bounding rectangle that specifies where to draw a button.
Called by the framework to draw the property description.
virtual void OnDrawDescription(
CDC* pDC,
CRect rect);
pDC
[in] A pointer to a device context.
rect
[in] A bounding rectangle that specifies where to draw the property description.
By default, this method draws the property name and description in the font used by the parent property list control. The property description is drawn in regular style and the property name is drawn in bold style.
Called by the framework to draw an expand box control near a property that contains subproperties.
virtual void OnDrawExpandBox(
CDC* pDC,
CRect rectExpand);
pDC
[in] A pointer to a device context.
rectExpand
[in] A bounding rectangle that specifies where to draw the expand box control.
Select the expand box control to expand or collapse a list of subproperties. The expand box control is designated by a square that contains a plus (+) or minus (-) sign. A plus sign indicates that the property can be expanded to show a list of subproperties. A minus sign indicates that the list can be collapsed to show only the property.
Called by the framework to display the property name.
virtual void OnDrawName(
CDC* pDC,
CRect rect);
pDC
[in] A pointer to a device context.
rect
[in] A bounding rectangle that specifies where to draw the property name.
Called by the framework to display the property value.
virtual void OnDrawValue(
CDC* pDC,
CRect rect);
pDC
[in] A pointer to a device context.
rect
[in] A bounding rectangle that specifies where to draw the property value.
Called by the framework when the user is about to modify a property value.
virtual BOOL OnEdit(LPPOINT lptClick);
lptClick
[in] (This parameter isn't used.) A pointer to a point, in client coordinates.
TRUE
if the edit operation starts successfully; otherwise, FALSE
.
This function is called by the framework when the user is about to modify a property value. By default, this method starts the appropriate editor for a combo box control or a spin control.
Called by the framework when the user is finished modifying a property value.
virtual BOOL OnEndEdit();
This method always returns TRUE
.
By default, this method destroys the current editing control and then returns TRUE
.
Called by the framework when the property loses the input focus.
virtual BOOL OnKillFocus(CWnd*);
CWnd
[in] (Not used.) Pointer to a window.
This method always returns TRUE
.
By default, this method does nothing and then returns TRUE
. If you override this method, return TRUE
if the framework can end the edit operation when the property loses the input focus.
virtual void OnKillSelection(CMFCPropertyGridProperty*);
[in] CMFCPropertyGridProperty*
\
By default, this method does nothing.
virtual void OnPosSizeChanged(CRect);
[in] CRect
\
By default, this method does nothing.
Called by the framework when the user selects the right mouse button in the property name area.
virtual void OnRClickName(CPoint C);
C
[in] A point, in client coordinates.
By default, this method does nothing.
Called by the framework when the user selects the right mouse button in the property value area.
virtual void OnRClickValue(
CPoint C,
BOOL B);
C
[in] A point, in client coordinates.
B
[in] A Boolean.
By default, this method does nothing and the B
parameter has no predefined purpose.
Called by the framework when the user selects an item from the editable combo box.
virtual void OnSelectCombo();
By default, this method uses the text of the selected item to update the property value.
Called by the framework when the mouse pointer moves to a property item.
virtual BOOL OnSetCursor() const;
TRUE
if the current property is a variant type or a list of values, and this method successfully loads the insertion point (I-beam) mouse cursor; otherwise, FALSE
.
This method supports the following variant types: VT_INT
, VT_I2
, VT_I4
, VT_UINT
, VT_UI1
, VT_UI2
, VT_UI4
, VT_R4
, VT_R8
, and VT_BSTR
.
virtual void OnSetSelection CMFCPropertyGridProperty*);
[in] CMFCPropertyGridProperty*
\
By default, this method does nothing.
Called by the framework when the value of an editable property has changed.
virtual BOOL OnUpdateValue();
TRUE
if this method is successful; otherwise, FALSE
.
Called from the property list control when the property is selected and the user enters a new character.
virtual BOOL PushChar(UINT nChar);
nChar
[in] A character.
TRUE
if the edit operation is continuing; otherwise, FALSE
.
This method supports a property that is either a list of values or one of the following variant types: VT_INT
, VT_I2
, VT_I4
, VT_UINT
, VT_UI1
, VT_UI2
, VT_UI4
, VT_R4
, VT_R8
, and VT_BSTR
.
Redraws the property.
void Redraw();
Removes all options (items) from a property.
void RemoveAllOptions();
Options are also known as the list items of a property list control.
Removes the specified subitem.
BOOL RemoveSubItem(
CMFCPropertyGridProperty*& pProp,
BOOL bDelete=TRUE);
pProp
[in] Pointer to a property subitem.
bDelete
[in] TRUE
to delete the property object that is specified by the pProp
parameter; otherwise, FALSE
. The default value is TRUE
.
Specify FALSE
for the bDelete
parameter if you intend to move the specified subitem; that is, remove the subitem and then add it elsewhere.
Restores the original value of an edited property.
virtual void ResetOriginalValue();
Associates a DWORD
value with a property.
void SetData(DWORD_PTR dwData);
dwData
[in] An application-specific 32-bit value, such as an integer or a pointer to other data.
Use the CMFCPropertyGridProperty::GetData
method to retrieve the DWORD
value. Use the CMFCPropertyGridCtrl::FindItemByData
method to locate the property list item that is associated with the specified DWORD
value.
Specifies the text that describes the current property.
void SetDescription(const CString& strDescr);
strDescr
[in] Text that describes the current property.
Sets the name of a property.
void SetName(
LPCTSTR lpszName,
BOOL bRedraw=TRUE);
lpszName
[in] The property name.
bRedraw
[in] TRUE
to redraw the property immediately; otherwise, FALSE
. The default value is TRUE
.
Sets the original value of an editable property.
virtual void SetOriginalValue(const COleVariant& varValue);
varValue
[in] A value.
Use the CMFCPropertyGridProperty::ResetOriginalValue
method to reset the original value of an edited property.
Sets the value of a property grid property.
virtual void SetValue(const _variant_t& varValue);
varValue
[in] A reference to the value to set the property to.
void SetPropBarValue(UINT propId, const DWORD& barPropDwordValue)
{
auto property = propertiesGridCtrlList.FindItemByData(propId);
if (property != nullptr)
{
property->SetValue(static_cast<_variant_t >(barPropDwordValue == 1)); // set value to true or false depending on dword value
}
}
Shows or hides a property.
void Show(
BOOL bShow=TRUE,
BOOL bAdjustLayout=TRUE);
bShow
[in] TRUE
to display the current property and its subitems; FALSE
to hide the current property and its subitems. The default value is TRUE
.
bAdjustLayout
[in] TRUE
to recalculate how to draw the label and value of a property and then draw the property; FALSE
to use existing calculations to draw the property. The default value is TRUE
.