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 » Property grid draw problem Collapse All
Subject Author Date
Suhai Gyorgy Feb 16, 2007 - 1:23 PM

I noticed some drawing problem in the property grid. I could reproduce it in your PropertyGrid sample. I just added a new button on the main dialog and in its "clicked" message handler I wrote the following code:

void CMainDlg::OnNewButtonClicked()
{
	m_PGC.SetRedraw( FALSE );
	CExtPropertyGridWnd *pActiveGrid = m_PGC.GetActiveGrid();
	ASSERT_VALID(pActiveGrid);
	CExtPropertyItem *pFocusedItem = pActiveGrid->PropertyItemFromTreeItem(pActiveGrid->ItemFocusGet());
	m_PGC.PropertyStoreSynchronize();
	if (pFocusedItem != NULL)
		pActiveGrid->ItemFocusSet( pActiveGrid->PropertyItemToTreeItem( pFocusedItem ) );
	m_PGC.SetRedraw( TRUE );
	m_PGC.RedrawWindow( NULL, NULL, RDW_INVALIDATE|RDW_ERASE|RDW_ALLCHILDREN );
}
After running the sample, I start clicking the up or down button of any of the grid cells with up-down button, and then click on the new button of the dialog. The button last clicked in the grid turns to pressed state and the only way to remove this state is to click it again. If I don’t call PropertyStoreSynchronize(), the drawing problem doesn’t appear.

Could you check this, please? Thank you!

Technical Support Feb 17, 2007 - 1:19 PM

Thank you for reporting the bug. The problem occurred because grid cell assignment moved the __EGCS_PRESSED grid cell style from the source grid cell into the destination one. You can fix this problem by removing this style:

void CExtPropertyItem::OnGridRowInitialized(
      CExtPropertyGridWnd & wndPG,
      HTREEITEM hTreeItem,
      CExtGridCell * pCellCaption,
      CExtGridCell * pCellValue
      )
{
      ASSERT_VALID( this );
      ASSERT_VALID( (&wndPG) );
      ASSERT( hTreeItem != NULL );
      ASSERT_VALID( pCellCaption );
#ifdef _DEBUG
      if( pCellValue != NULL )
      {
            ASSERT_VALID( pCellValue );
      }
#endif
      pCellCaption;
      pCellValue;
      if( wndPG.ItemIsExpanded( hTreeItem ) )
      {
            if( ! ExpandedGet() )
                  wndPG.ItemExpand( hTreeItem, TVE_COLLAPSE );
      }
      else
      {
            if( ExpandedGet() )
                  wndPG.ItemExpand( hTreeItem, TVE_EXPAND );
      }
      if( pCellValue != NULL )
      {
            pCellValue->ModifyStyle( 0, __EGCS_PRESSED ); // THIS LINE WAS ADDED
            pCellValue->ModifyStyleEx( 0, __EGCS_EX_UNDEFINED_ROLE );
      }
}