EDN Admin
Well-known member
Hi, Guys,
I have been trying to validate and update data back to the original objects from a CMFCPropertyGridCtrl derived class CMFCPropList. But in the override of ValidateItemData function, the values obtain from CMFCPropertyGridProperty are always the original (not the edited) values except for combo box selection items. I searched the MSDN and can not find any other functions like GetItemText() etc. for getting the edited value. I could not obtain the edited values.
<div style="border-right:#7f9db9 1px solid;border-top:#7f9db9 1px solid;font-size:11px;overflow:auto;border-left:#7f9db9 1px solid;line-height:100%! important;border-bottom:#7f9db9 1px solid;font-family:Courier New;background-color:white
<table style="border-top-width:0px;border-left-width:0px;margin:2px 0px;width:99%;border-bottom:#eee 0px solid;border-collapse:collapse;background-color:#fff;border-right-width:0px" cellspacing=0 cellpadding=0>
<colgroup>
<col style="padding-left:10px;font-size:11px;border-bottom:#f7f7f7 1px solid;font-family:Courier New;white-space:nowrap
<tbody>
<tr>
<td><font style="font-size:11px BOOL CMFCPropList::ValidateItemData(CMFCPropertyGridProperty* pProp) </font></td></tr>
<tr>
<td style="background-color:#f7f7f7 { </td></tr>
<tr>
<td> DWORD_PTR </font><font style="color:red dwData</font><font style="font-size:11px = </font><font style="color:blue pProp</font><font style="font-size:11px -</font><font style="color:blue ></font><font style="font-size:11px GetData(); </font></td></tr>
<tr>
<td style="background-color:#f7f7f7 const COleVariant& </font><font style="color:red value</font><font style="font-size:11px = </font><font style="color:blue pProp</font><font style="font-size:11px -</font><font style="color:blue ></font><font style="font-size:11px GetValue(); </font></td></tr>
<tr>
<td> CMFCPropertyGridProperty* </font><font style="color:red pProp2</font><font style="font-size:11px = </font><font style="color:blue GetCurSel</font><font style="font-size:11px (); </font></td></tr>
<tr>
<td style="background-color:#f7f7f7 const COleVariant& </font><font style="color:red value2</font><font style="font-size:11px = </font><font style="color:blue pProp2</font><font style="font-size:11px -</font><font style="color:blue ></font><font style="font-size:11px GetValue(); </font></td></tr>
<tr>
<td> return TRUE; </td></tr>
<tr>
<td style="background-color:#f7f7f7 } </td></tr></tbody></table>
To update data back to the original objects, I tried to override the OnPropertyChanged(pProp) function, but in debugging, the program never run into the function no matter how the proerties was changed. I also tried to use PreTranslateMessage(msg) of the parent window to catch the AFX_WM_PROPERTY_CHANGED message, but it was also never sent no matter how the properties was changed.
Could anybody give me some clue as how to validate and update data from a property grid control. Any suggestions, tips and help are welcome and greatly appreciated.
View the full article
I have been trying to validate and update data back to the original objects from a CMFCPropertyGridCtrl derived class CMFCPropList. But in the override of ValidateItemData function, the values obtain from CMFCPropertyGridProperty are always the original (not the edited) values except for combo box selection items. I searched the MSDN and can not find any other functions like GetItemText() etc. for getting the edited value. I could not obtain the edited values.
<div style="border-right:#7f9db9 1px solid;border-top:#7f9db9 1px solid;font-size:11px;overflow:auto;border-left:#7f9db9 1px solid;line-height:100%! important;border-bottom:#7f9db9 1px solid;font-family:Courier New;background-color:white
<table style="border-top-width:0px;border-left-width:0px;margin:2px 0px;width:99%;border-bottom:#eee 0px solid;border-collapse:collapse;background-color:#fff;border-right-width:0px" cellspacing=0 cellpadding=0>
<colgroup>
<col style="padding-left:10px;font-size:11px;border-bottom:#f7f7f7 1px solid;font-family:Courier New;white-space:nowrap
<tbody>
<tr>
<td><font style="font-size:11px BOOL CMFCPropList::ValidateItemData(CMFCPropertyGridProperty* pProp) </font></td></tr>
<tr>
<td style="background-color:#f7f7f7 { </td></tr>
<tr>
<td> DWORD_PTR </font><font style="color:red dwData</font><font style="font-size:11px = </font><font style="color:blue pProp</font><font style="font-size:11px -</font><font style="color:blue ></font><font style="font-size:11px GetData(); </font></td></tr>
<tr>
<td style="background-color:#f7f7f7 const COleVariant& </font><font style="color:red value</font><font style="font-size:11px = </font><font style="color:blue pProp</font><font style="font-size:11px -</font><font style="color:blue ></font><font style="font-size:11px GetValue(); </font></td></tr>
<tr>
<td> CMFCPropertyGridProperty* </font><font style="color:red pProp2</font><font style="font-size:11px = </font><font style="color:blue GetCurSel</font><font style="font-size:11px (); </font></td></tr>
<tr>
<td style="background-color:#f7f7f7 const COleVariant& </font><font style="color:red value2</font><font style="font-size:11px = </font><font style="color:blue pProp2</font><font style="font-size:11px -</font><font style="color:blue ></font><font style="font-size:11px GetValue(); </font></td></tr>
<tr>
<td> return TRUE; </td></tr>
<tr>
<td style="background-color:#f7f7f7 } </td></tr></tbody></table>
To update data back to the original objects, I tried to override the OnPropertyChanged(pProp) function, but in debugging, the program never run into the function no matter how the proerties was changed. I also tried to use PreTranslateMessage(msg) of the parent window to catch the AFX_WM_PROPERTY_CHANGED message, but it was also never sent no matter how the properties was changed.
Could anybody give me some clue as how to validate and update data from a property grid control. Any suggestions, tips and help are welcome and greatly appreciated.
View the full article