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 Tech Support » Problem with CExtPropertyValue and CExtGridCellCheckListComboBox Collapse All
Subject Author Date
Offer Har Nov 29, 2006 - 10:20 PM

Hi,

I have a property grid with cells called CCheckComboProperty that contains a cell of type CExtGridCellCheckListComboBox.

This is what I do in the cell’s c’tor:

CExtGridCellCheckListComboBox* pCell = STATIC_DOWNCAST(CExtGridCellCheckListComboBox, ValueActiveGetByRTC(RUNTIME_CLASS(CExtGridCellCheckListComboBox)));

I have added a function called AddItem:

bool CCheckComboProperty::AddItem(CString strName, int nItemData)
{
    CExtGridCellCheckListComboBox* pCell = (CExtGridCellCheckListComboBox*)ValueActiveGet();
    pCell->AddString(strName, nItemData);
    return true;
}

And it is called several items.

The problem is that nothing happens - the list is not filled.

What am i missing?

Please note that if I call AddString on the cell i got in the c’tor it works.
Do I need to call any other function in order for my changes to be displayed in the cell?

Thanks,
Ron.

Suhai Gyorgy Nov 30, 2006 - 2:15 AM

Any CExtPropertyValue object contains two CExtGridCell grid cell objects: the default value and the current value. These are the ones you get when calling ValueDefaultGet and ValueActiveGet. But there’s a third cell that has to be taken in consideration in this case: The cell that is displayed in the currently active CExtPropertyGridWnd. When user changes something in this last cell, PropertyGrid calls Apply, which in turn should assign the value in this cell to the CExtPropertyValue’s active cell.

So main thing: When you call AddItem from somewhere outside the constructor, you adding items only to the CExtPropertyValue’s active cell, not to the cell displayed in the grid. It works in the contructor fine because the displayed cell gets initialized from the CExtPropertyValue’s active cell after the constructor was called. If you change the PropertyStore in any way and you want to display this changed one in the grid, you have to call PropertyStoreSynchronize method. This messes with your CExtPropertyGridTipBar, so if you have that displayed, you better call it like this:

			CExtPropertyGridCtrl * pPGC = ...;
			pPGC->SetRedraw( FALSE );
			pPGC->PropertyStoreSynchronize();
			pPGC->SetRedraw( TRUE );
			pPGC->RedrawWindow( NULL, NULL, RDW_INVALIDATE|RDW_ERASE|RDW_ALLCHILDREN );

Offer Har Nov 30, 2006 - 6:07 AM

Thanks!
Now it’s all clear (and works...)

Question - how do you format your posts like the support does?

Suhai Gyorgy Nov 30, 2006 - 7:18 AM

I’m using HTML tags: <pre><code>my code</code></pre>

Offer Har Nov 30, 2006 - 7:21 AM

Thanks...

Offer Har Nov 30, 2006 - 6:15 AM

Dear Support,

I would like to return and iterate that this does not work for the CExtGridCellCheckListComboBox type cell when changing the check status, event if I call PropertyStoreSynchronize, the content of the displayed cell does not change, and the drop list does not show the new checked items.

Please fix.
Thanks,
Ron.

Technical Support Nov 30, 2006 - 1:04 PM

It seems we found what the problem was caused by. Please find the CExtGridCellComboBox declaration and update these two ITEM_INFO constructors:

ITEM_INFO(
    __EXT_MFC_SAFE_LPCTSTR lpszString,
    DWORD dwItemData = 0,
    INT nImage = -1,
    INT nSelectedImage = -1,
    INT nOverlayImage = -1,
    INT nIndent = 0,
    INT nCheck = 0
    )
    : m_sString( lpszString )
    , m_dwItemData( dwItemData )
    , m_nImage( nImage )
    , m_nSelectedImage( nSelectedImage )
    , m_nOverlayImage( nOverlayImage )
    , m_nIndent( nIndent )
    , m_nCheck( nCheck )
{
}
ITEM_INFO( const ITEM_INFO & other )
    : m_sString( other.m_sString )
    , m_dwItemData( other.m_dwItemData )
    , m_nImage( other.m_nImage )
    , m_nSelectedImage( other.m_nSelectedImage )
    , m_nOverlayImage( other.m_nOverlayImage )
    , m_nIndent( other.m_nIndent )
    , m_nCheck( other.m_nCheck )
{
}




Offer Har Nov 30, 2006 - 1:22 PM

This does not solve the problem!
Please check it again.

Offer Har Nov 30, 2006 - 1:26 PM

It DOES fix the problem.... ;-)
Got the wrong inputs from the QA team
Thanks!
Ron.