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 » Tip panel of property grid is flickering when the cells of the property grid are updated Collapse All
Subject Author Date
Andreas Werner Oct 27, 2006 - 7:42 AM

Hallo,

I have a property store with 12 property Items and 4 property categories. The properties represent the attributes of a business object. Each time the user selects a different instance of the business object I change the values of the property items to the values of the attributes of the currently selected business object.
The trigger to update the property items is the selection in a list. The following code example demonstrates what is happening:

void CMyDialog::OnItemchangedCustumListCtrl(NMHDR* pNMHDR, LRESULT* pResult)
{
    NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
    pNMListView;
    
    INT n = pNMListView->iItem;
    Item1->ValueActiveSet(BusinessObject[n].GetProperty1());
    Item2->ValueActiveSet(BusinessObject[n].GetProperty2());
    Item3->ValueActiveSet(BusinessObject[n].GetProperty3());
    Etc …
    Item12->ValueActiveSet(BusinessObject[n].GetProperty12());

    m_PGC.PropertyStoreSynchronize();
    
    *pResult = 0;
}

1. Question:
The update of the cells of the property grid works smooth, but the text in the tip panel (CExtPropertyGridTipBar) at the bottom of the property grid is flickering. It seems that the tip panel is updated 12 times, each time when ValueActiveSet() is invoked.

Is there a way to stop the flickering of the tip panel?


2. Question:
Each time I update the property gird the tip panel shows the tip text of the category that was inserted as the last one to the property store.
Is there a way to tell the tip panel to show the tip text of the category that was inserted as the first one?

Technical Support Oct 28, 2006 - 11:35 AM

The first issue can be reproduced with the PropertyGrid sample when the Selected stars item is selected in the combo box and you change the checked state of star buttons. The flicker of the tip area can be prevented in the PropertyGrid sample locally and you can use the same approach in your project:

void CMainDlg::_CombineMixedStoreSelection()
{
    m_PropertyStoreCompoundSelection.ItemRemove();
    if( m_Btn1.SelectedStateGet() )
        m_PropertyStoreCompoundSelection.Combine( m_Btn1.GetPropertyStore() );
    if( m_Btn2.SelectedStateGet() )
        m_PropertyStoreCompoundSelection.Combine( m_Btn2.GetPropertyStore() );
    if( m_Btn3.SelectedStateGet() )
        m_PropertyStoreCompoundSelection.Combine( m_Btn3.GetPropertyStore() );
    if( m_Btn4.SelectedStateGet() )
        m_PropertyStoreCompoundSelection.Combine( m_Btn4.GetPropertyStore() );
CExtPropertyGridComboBoxBar * pCombo =
        STATIC_DOWNCAST(
            CExtPropertyGridComboBoxBar,
            m_PGC.GetChildByRTC(
                RUNTIME_CLASS(CExtPropertyGridComboBoxBar)
                )
            );
    if( pCombo == NULL )
        return;
    ASSERT_VALID( pCombo );
    if( pCombo->GetCurSel() == 0 )
    {
        m_PGC.SetRedraw( FALSE );
        m_PGC.PropertyStoreSynchronize();
        m_PGC.SetRedraw( TRUE );
        m_PGC.RedrawWindow( NULL, NULL, RDW_INVALIDATE|RDW_ERASE|RDW_ALLCHILDREN );
    }
}
We have protected the invocation of the m_PGC.PropertyStoreSynchronize() code with the SetRedraw() and RedrawWindow() APIs.

The second issue means you should select the known property item (category or value) in the property grid control before it is repainted:
CExtPropertyGridCtrl & _PGC = . . .
CExtPropertyItem * pPropertyItem = . . . // CExtPropertyCategory or CExtPropertyValue
CExtPropertyGridWnd * pActiveGrid = _PGC.GetActiveGrid();
HTREEITEM hTreeItem = pActiveGrid->PropertyItemToTreeItem( pPropertyItem );
    pActiveGrid->ItemFocusSet( hTreeItem );
The property grid control automatically synchronizes selection in all inserted tree grid windows.

Andreas Werner Oct 30, 2006 - 7:57 AM

That was what I have been looking for.
Thank you for your help :-)