RGBAPropertyValue::RGBAPropertyValue(const std::string &name,
const std::string &description, COLORREF rgb, int alpha)
: CExtPropertyValueCompound(name.c_str())
{
CExtGridCellUpDownColorPart *color_component;
DescriptionSet(description.c_str());
// RGB value.
_rgb_value = STATIC_DOWNCAST(CExtGridCellColor,
ValueDefaultGetByRTC(RUNTIME_CLASS(CExtGridCellColor)));
assert(_rgb_value != NULL);
_rgb_value->m_PackedColor.SetColor(rgb);
_rgb_value->SetMode(CExtGridCellColor::eRGB);
ValueActiveFromDefault();
// Red value.
_red_value = new CExtPropertyValue("R");
_red_value->DescriptionSet("Red");
color_component = STATIC_DOWNCAST(CExtGridCellUpDownColorPart,
_red_value->ValueDefaultGetByRTC(RUNTIME_CLASS(CExtGridCellUpDownColorPart)));
assert(color_component != NULL);
color_component->m_eCPT = CExtGridCellUpDownColorPart::__ECPT_RED;
color_component->_VariantAssign(GetRValue(rgb), VT_I4);
_red_value->ValueActiveFromDefault();
ItemInsert(_red_value);
// Green value.
_green_value = new CExtPropertyValue("G");
_green_value->DescriptionSet("Green");
color_component = STATIC_DOWNCAST(CExtGridCellUpDownColorPart,
_green_value->ValueDefaultGetByRTC(RUNTIME_CLASS(CExtGridCellUpDownColorPart)));
assert(color_component != NULL);
color_component->m_eCPT = CExtGridCellUpDownColorPart::__ECPT_GREEN;
color_component->_VariantAssign(GetGValue(rgb), VT_I4);
_green_value->ValueActiveFromDefault();
ItemInsert(_green_value);
// Blue value.
_blue_value = new CExtPropertyValue("B");
_blue_value->DescriptionSet("Blue");
color_component = STATIC_DOWNCAST(CExtGridCellUpDownColorPart,
_blue_value->ValueDefaultGetByRTC(RUNTIME_CLASS(CExtGridCellUpDownColorPart)));
assert(color_component != NULL);
color_component->m_eCPT = CExtGridCellUpDownColorPart::__ECPT_BLUE;
color_component->_VariantAssign(GetBValue(rgb), VT_I4);
_blue_value->ValueActiveFromDefault();
ItemInsert(_blue_value);
// Alpha value.
_alpha_value = new CExtPropertyValue("A");
_alpha_value->DescriptionSet("Alpha");
color_component = static_cast<CExtGridCellUpDownColorPart *>
(_alpha_value->ValueDefaultGetByRTC(RUNTIME_CLASS(CExtGridCellUpDownColorPart)));
assert(color_component != NULL);
color_component->m_eCPT = CExtGridCellUpDownColorPart::__ECPT_UNKNOWN;
color_component->_VariantAssign(alpha, VT_I4);
_alpha_value->ValueActiveFromDefault();
ItemInsert(_alpha_value);
}
When the code in orange is commented, correct values are assigned to the sub properties (R, G, B).
But it seems if there is more than 3 sub properties in the CExtGridCellColor, editing the color from the color node (the parent one) doesn’t report the values to the component nodes (child nodes).