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 » CExtPropertyGridCtrl and OnPgcInputComplete Collapse All
Subject Author Date
D. Cameron DeHeer Dec 6, 2007 - 11:12 AM

Hello,
Sorry if this is covered elsewhere but I searched the forums and didn’t see anything similar to what I am trying to do.

I have a CExtPropertyGridCtrl subclass that responds to OnPgcInputComplete, and based on the incoming property being changed I may want to change other properties that are related. Here’s a code example that attempts to change the size value of a field when the data type is changed:

CExtPropertyValue *pPropertyValue = DYNAMIC_DOWNCAST(
    CExtPropertyValue,
    pPropertyItem
    );
CTableFieldPropertyStore *pPropertyStore = DYNAMIC_DOWNCAST(
    CTableFieldPropertyStore,
    pPropertyItem->GetStore()
    );
if (pPropertyValue &&
    pPropertyStore)
{
    CExtSafeString strPropertyName = pPropertyValue->NameGet();
    field = pPropertyStore->GetField();
    if (strPropertyName == "Data Type")
    {
     CExtGridCellComboBox *pCellDataType = STATIC_DOWNCAST(
        CExtGridCellComboBox,
        pPropertyValue->ValueActiveGet()
        );
     field->put_type(data_field::get_type_from_index(pCellDataType->GetCurSel()));
     CExtGridCellUpDown *pCellSize = STATIC_DOWNCAST(
        CExtGridCellUpDown,
        pPropertyStore->pValueSize->ValueActiveGet()
        );
     pCellSize->_VariantAssign(field->get_size());
    }
}

The effect of the pCellSize->_VariantAssign is to make the value in the grid go bold, as if it has changed, but the displayed text value does not change. For example, if I change the data type to an unsigned long int, and set the new size accordingly to 4, the existing value in the field goes bold but does not change to 4. Selecting a different item in the grid control combo box and re-selecting the changed item does update the displayed value. Any ideas what I’m doing wrong here? Thanks in advance for any help...
Cameron

Technical Support Dec 6, 2007 - 12:44 PM

The direct access to property values inside a property grid control with grid cell modification is described here.