Professional UI Solutions
Site Map   /  Register
 
 

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.

Forums » Prof-UIS General Discussion » Problem with Collapse All
Subject Author Date
a a Jan 22, 2006 - 7:44 PM

  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).

Technical Support Jan 26, 2006 - 3:58 AM

The current version of the color picker cell cannot display additional fields like the alpha channel. If the text format does not correspond to the supported color format, then this is assumed as a parsing error. We can regard your need as a custom work or as a feature request.

a a Jan 27, 2006 - 4:38 AM

Ok.


Actually I don’t really understand the mecanism... Is it the ColorCell or the CompoundValue that parses and performs the data exchange?


Assuming it is the color cell that parses, and the CompoundValue node updates Red, Green, Blue child values,
it would be nice if the the color cell picker could be "unlocked" so that it scans only the beginning.
(Hmmm, maybe there’s a problem when the user selects a color from a the picker dialog...)
Is that possible? (or something similar)


I don’t understand either how the CompoundValue is doing the assignments. If the CompoundValue considers the ’,’ is the separator for child values,
then there is a confusion if a child is composed of ’,’, like the color cell.


PS: RGBA values are used in 3D, especially video game industries. If it wouldn’t be too much of work, I wish it was considered as a feature request.


Thanks

Technical Support Jan 28, 2006 - 9:50 AM

Both the compound property value and color value are based on text values of their subfields and the list separator character from the Windows locale settings. The list separator character is often "," or ";" but can be reconfigured to any other symbol. If the text representation of some simple property value inside the compound value contains a character equal to the list separator value, then the grid cell of this simple property value parses the text property according to its specific rules and eats up the characters equal to the list separator character from Windows locale settings. The entire modification of the compound value’s text is based on the tree traversing algorithm which walks through the sub tree of property values where each of them skips some part of compound text when parses its own data.

We do not mind to implement the RGBA color property. Please give us more details about this kind of the grid cell. Do we simply need to add the optional Alpha channel support to the existing CExtGridCellColor class?


a a Jan 29, 2006 - 6:18 PM

Yes.


The alpha channel would have the same behaviour as the RGB channels.
That is, a value inside [0, 255], and I guess the combo button would display icons degrading from white(0) to black(255) (if there is).


Thanks. I appreciate your support.

Technical Support Feb 6, 2006 - 11:46 AM

We will add the RGBA mode in the next release. Would it be OK or you have some deadlines?

a a Feb 6, 2006 - 9:25 PM

Thanks.
I’ll be OK.