Professional UI Solutions
Site Map   /  Register


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 » ComboBox used in PropertyGrid doesn't show initial value in cell Collapse All
Subject Author Date
Malcolm D Jul 10, 2007 - 10:24 PM

I think this is a bug with the CExtGridCellComboBox (and possibly derived classes). When you use this in a property grid value item the initial selection doesn’t show. It also seems the "modified" state which is shown by being bold or not is also incorrect.

The sample property grid shows this. The Animation property under Behaviour is a combo box - initially it doesn’t show the text of the selected item, but if you click the drop down you can see the selected item in the list. If you select any items it then shows the text of the selected item in the cell. The cell is also shown as bold initially which (I think) indicates the item was modified (which is hasn’t been). But when you then select any item it then shows it as non-bold for any value selected - this is also wrong behaviour.

The problem seems to be with the "void CExtGridCellComboBox::Assign( const CExtGridCell & other )" function where there is a ResetContents() call which sets the m_str to "" and the m_pCurSel to NULL (via a call to SetCurSel() ). The m_pCurSel is later assigned a value but the string is left as "".
I’m not sure about why the bold state is incorrect. Fixing the first problem may fix the second, but it may not.

Technical Support Jul 11, 2007 - 9:06 AM

We recently fixed a bug in the CExtGridCellComboBox class. Please update the following method and recompile the library.

void CExtGridCellComboBox::Assign( const CExtGridCell & other )
    ASSERT_VALID( this );
    CExtGridCellString::Assign( other );
CExtGridCellComboBox * pCell =
            ( const_cast < CExtGridCell * > ( &other ) )
    if( pCell != NULL )
        // copy cell items
        ITEM_INFO * pItemCurSel = NULL;
        LONG nItem = 0;
        for( nItem = 0; nItem < pCell->m_arrItems.GetSize(); nItem++ )
            ITEM_INFO * pOtherItem = pCell->m_arrItems[ nItem ];
            ITEM_INFO * pNewItem = new ITEM_INFO( *pOtherItem );
            m_arrItems.Add( pNewItem );
            if( pCell->m_pCurSel == pOtherItem )
                pItemCurSel = pNewItem;
        m_bEnumMode = pCell->m_bEnumMode;
        SetImageList( pCell->m_pImageList );
        if( pItemCurSel != NULL )
            nItem = _GetIndexOf( pItemCurSel );
            SetCurSel( nItem );
    } // if( pCell != NULL )