CGXAbstractUserAttribute::SetValue
virtual CGXAbstractUserAttribute& SetValue(LPCTSTR pszValue);
virtual CGXAbstractUserAttribute& SetValue(const CString& strValue);
pszValue
A pointer to the string with the text value.
strValue
A CString with the tex value.
Remarks
SetValue is called with a CString and changes the value of your attribute. Override this method if you want to support reading values from registry or the user attribute page. In your override you should interprete the CString and convert it to your binary representation of the value.
Example:
CGXAbstractUserAttribute& CGXUserAttribute::SetValue(LPCTSTR pszValue)
{
if (m_vtType == vtString)
// Strings must be emptied because they allocated heap space
delete m_value.pszValue;
double d;
if (_tcslen(pszValue) == 0)
{
m_vtType = vtEmpty;
}
else if (GXDeval(pszValue, &d))
{
m_vtType = vtDouble;
m_value.dValue = d;
}
else if (_tcslen(pszValue) <= 8/sizeof(TCHAR))
{
m_vtType = vtShortString;
_tcsncpy(m_value.szShortString, pszValue, 8/sizeof(TCHAR));
}
else
{
m_vtType = vtString;
m_value.pszValue = new TCHAR[_tcslen(pszValue)+1];
_tcscpy(m_value.pszValue, pszValue);
}
return *this;
}