Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to detect properly value modifications on a PropertyGrid (MFC)?
    primarykey
    data
    text
    <p>I've been developing a program in MFC which fills a PropertyGrid with some data located in a database of mine. One of the fields from this PropertyGrid contains data related to a person's age. Here's the implementation:</p> <pre><code> CMFCPropertyGridProperty * pProp = new CMFCPropertyGridProperty(_T("Age"), (variant_t)PropAge-&gt;GetNext(headAge), _T("This is a description")); pProp-&gt;EnableSpinControl(TRUE, 0, 150); pGroup-&gt;AddSubItem(pProp); </code></pre> <p>Where <code>PropAge</code> is a <code>CList</code> containing the <code>age (integer) of each person's register</code>.</p> <p>Here's my problem: when I try to modify it's value (using the SpinControl or typing another value), the new value does not appear with the bold font. Moreover, when I use the method <code>IsModified()</code>, it returns false:</p> <pre><code>void CPropertiesWnd::DoSomething() { CMFCPropertyGridProperty * PropSel; PropSel = m_wndPropList.GetCurSel(); bool a = PropSel-&gt;GetSubItem(1)-&gt;IsModified(); //SubItem containing the Age data. //Returns False when it's modified! //It always returns 'false', even if //there was made a modification. } </code></pre> <p>I used the Debugger to check what was going on and saw something really interesting:</p> <p><a href="http://img836.imageshack.us/img836/8256/c90j.jpg" rel="nofollow">http://img836.imageshack.us/img836/8256/c90j.jpg</a></p> <p>(Note: <code>m_VarValue</code> represents the current value and <code>m_VarValueOrig</code> represents que value before the modification)</p> <p>as you can see, there is a type difference between the variables <code>m_VarValue</code> and <code>m_VarValueOrig</code>. (What does I4 mean?)</p> <p>I also noted that there are other subitems on this project that also deal with numbers, and they actually show when a modification was made. Their implementation is something like this: </p> <pre><code> pProp = new CMFCPropertyGridProperty(_T("Something"), (_variant_t) 0l, _T("")); </code></pre> <p>What does this 'l' right after the 0 means? Does it have something to do with the I4 type?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload