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 » CExtPropertyGridCtrl breaks app under Prof-UIS 2.81 Collapse All
Subject Author Date
Andrew Moulden Oct 27, 2007 - 12:53 PM

Hi,

I have just installed Prof-UIS 2.81 and my app is no longer functioning due to an assertion that is being thrown when I set a new property store in a CExtPropertyGridCtrl-derived class.

The issue appears to occur when the newly installed property store has fewer rows than the old property store, and when the row number of the focused cell in the old store is greater than the maximum number of rows in the new store. In other words the grid window calls FocusGet() and this returns the row number in the old property store, and when a check is made to ensure that this row number is less than the number of rows in the new property store, an assertion is thrown.

Hopefully this is enough info to identify the problem, but here’s the relevant part of the call stack. Note that the nRowNo in these calls is 9 when in fact the property store in the PropertyStoreSet() call only has 8 rows.

V01.exe!CExtTreeGridDataProvider::_Tree_MapRowToCache(unsigned long nRowNo=9) Line 2259 + 0x2a
V01.exe!CExtTreeGridDataProvider::_Tree_NodeGetByVisibleRowIndex(unsigned long nRowNo=10) Line 932 + 0x14
V01.exe!CExtTreeGridDataProvider::TreeNodeGetByVisibleRowIndex(unsigned long nRowNo=10) Line 917 + 0x14
V01.exe!CExtTreeGridWnd::ItemGetByVisibleRowIndex(long nRowNo=10) Line 3089 + 0xc
V01.exe!CExtTreeGridWnd::ItemFocusSet(_TREEITEM * hTreeItem=0x0258a814, long nColNo=1, bool bRedraw=true) Line 3762 + 0x14
V01.exe!CExtTreeGridWnd::ItemFocusSet(_TREEITEM * hTreeItem=0x0258a814, bool bRedraw=true) Line 3793 + 0x39
V01.exe!CExtPropertyGridCtrl::PropertyStoreSet(CExtPropertyStore * pPS=0x02629338) Line 9458
V01.exe!GPUISPropertyGrid::setCurrentPropertyStore(GPUISPropertyStore * propertyStore=0x02629338) Line 239
V01.exe!GPUISPropertyGrid::onNodeSelectionChange(const GNodeSelectionEvent & event={...}) Line 216
V01.exe!GEventListener<GPUISPropertyGrid,GNodeSelectionEvent>::fireEvent(const GNodeSelectionEvent & event={...}) Line 16 + 0x35
V01.exe!GListenerList<GNodeSelectionEvent>::fireEvent(const GNodeSelectionEvent & event={...}) Line 213 + 0x24
V01.exe!GNodeSelectionEvent::fire() Line 30
V01.exe!GSupport::fireEvent(GEvent & event={...}) Line 67 + 0xd
V01.exe!GNodeSelectionEvent::fireEvent(int senderID=2, unsigned int selectedNodeUID=1) Line 48
V01.exe!CConfigTreeCtrl::OnTvnSelchanged(tagNMHDR * pNMHDR=0x0012fa2c, long * pResult=0x0012f6f8) Line 222 + 0x10

Andrew Moulden Oct 29, 2007 - 1:35 PM

Thanks for the fix. No problems so far.

Technical Support Oct 29, 2007 - 10:29 AM

Thank you for reporting this issue. To fix it, please update the source code for the following method

bool CExtTreeGridWnd::ItemFocusSet(
      HTREEITEM hTreeItem,
      LONG nColNo,
      bool bRedraw // = true
      )
{
      ASSERT_VALID( this );
      if(         hTreeItem == NULL
            ||    hTreeItem == ItemGetRoot()
            )
            return false;
      if( ! ItemFocusIsLocked() )
      {
            CPoint ptFocus = FocusGet();
            if( ptFocus.y < 0 || ptFocus.y >= RowCountGet() )
            {
                  if( hTreeItem == NULL )
                        return false;
            } // if( ptFocus.y < 0 || ptFocus.y >= RowCountGet() )
            else
            {
                  if( hTreeItem == NULL )
                  {
                        SelectionUnset( false, false );
                        FocusUnset( bRedraw );
                        return true;
                  }
                  HTREEITEM htiFocus = ItemGetByVisibleRowIndex( ptFocus.y );
                  ASSERT( htiFocus != NULL );
                  if( htiFocus == hTreeItem && nColNo == ptFocus.x )
                        return false;
            } // else from if( ptFocus.y < 0 || ptFocus.y >= RowCountGet() )
            if( ! ItemEnsureExpanded( hTreeItem, false ) )
                  return false;
            ptFocus.x = nColNo;
            ptFocus.y = ItemGetVisibleIndexOf( hTreeItem );
            ASSERT( ptFocus.y >= 0 );
            if( bRedraw )
                  OnSwUpdateScrollBars();
            FocusSet( ptFocus, bRedraw, true, true, bRedraw );
      } // if( ! ItemFocusIsLocked() )
      else
      {
            if( bRedraw )
            {
                  OnSwUpdateScrollBars();
                  OnSwInvalidate( true );
            } // if( bRedraw )
      } // else from if( ! ItemFocusIsLocked() )
      return true;
}