Forum
Please
Log In
to post a new message or reply to an existing one. If you are not registered, please
register.
NOTE: Some forums may be read-only if you are not currently subscribed to
our technical support services.
Subject |
Author |
Date |
|
Ayubkhan Pathan
|
Mar 22, 2007 - 5:39 AM
|
I have property grid control with combo box and edit control. If I change the value manually and then try to get it, it is returning me default/initial value and not the modified one. How to get the currently selected value from the control.
Sample code which I wrote to get the the value CExtPropertyItem * pItem = pProperty->ItemGetByName(szPropName); CExtGridCellString* pValue = (CExtGridCellString*)pItem->ValueActiveGet(); pValue->TextGet(szValues);
|
|
Suhai Gyorgy
|
Mar 22, 2007 - 6:22 AM
|
In what method is this code? Are you overwriting CExtPropertyValue::Apply in your own value class? If this sample code is in the overwritten Apply method, you have to call the base-class’ Apply method before you could reach the currently selected value through ValueActiveGet. Otherwise you can find the current value through the pValue parameter of the Apply method, that CExtGridCell object has the current value. void CPropertyValue_Name::Apply( CExtGridCell *pValue /* = NULL*/)
{
ASSERT_VALID( this );
#ifdef _DEBUG
if( pValue != NULL )
{
ASSERT_VALID( pValue );
ASSERT_KINDOF( CExtGridCellString, pValue );
}
#endif // _DEBUG
if( m_pObject == NULL || pValue == NULL )
return;
CExtSafeString strText, strOrigText;
pValue->TextGet( strText ); // current text
ValueActiveGet()->TextGet( strOrigText ); // text before the change
if (strText != strOrigText)
m_pObject->SetName( strText.IsEmpty() ? _T("") : LPCTSTR(strText) );
CExtPropertyValue::Apply( pValue );
// Here the text has changed
ValueActiveGet()->TextGet( strOrigText );
ASSERT(strOrigText == strText);
}
|
|