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 » CExtPropertyGridWndCategorized assert Collapse All
Subject Author Date
Ian McIntosh Jan 30, 2008 - 2:49 AM

I have a class derived from CExtPropertyGridWndCategorized as I want to add sub categories only when the user presses expand for the first time.
My code seems to work, but I get an assert.

I get an assert in:
CExtTreeGridWnd::ItemEnsureVisibleBranch()
when it calls EnsureVisibleRow( nRowOffset, bRedraw ); with nRowOffset = -1.

I seem to be able to fix the assert by changing:
if( nRowOffset < rcVisibleRange.top )
{
EnsureVisibleRow( nRowOffset, bRedraw );
return;
}

to:
if( nRowOffset < rcVisibleRange.top )
{
if (nRowOffset!=(-1))
EnsureVisibleRow( nRowOffset, bRedraw );
return;
}

but as I’m not sure what this code is doing I’m not sure if it will have any side effects.
I can achieve this by overriding CExtTreeGridWnd::ItemEnsureVisibleBranch(), but is this the right thing to do?

My Grid Wnd is derived from CExtPropertyGridWndCategorized as follows:

class CExtPropertyGridWndCategorizedArc : public CExtPropertyGridWndCategorized
{
public:
CExtPropertyGridWndCategorizedArc(CExtPropertyGridCtrl* pPropertyGridCtrl = NULL)
: CExtPropertyGridWndCategorized(pPropertyGridCtrl) {}
virtual void ItemExpand(HTREEITEM hTreeItem, INT nActionTVE = TVE_TOGGLE,
bool bRedraw = true);
std::vector<HTREEITEM> m_vExpandedOnce;
};

void CArchivePropertyCtrl::CExtPropertyGridWndCategorizedArc::ItemExpand(HTREEITEM hTreeItem, INT nActionTVE, bool bRedraw)
{
CWaitCursor wc;
CExtPropertyItem* pItem = PropertyItemFromTreeItem(hTreeItem);
ASSERT(pItem);
bool bUpdated = false;
bool bExpanding = !pItem->ExpandedGet();
if ( bExpanding )
{
bool bFoundCategory=false;
int iCount = pItem->ItemGetCount();
for (int i=0; i<pItem->ItemGetCount(); i++)
{
CExtPropertyItem* pChild = pItem->ItemGetAt(i);
if (pChild->ItemGetCount()>0)
{
bFoundCategory = true;
break;
}
}
if (!bFoundCategory)
{
bUpdated = dynamic_cast<CArchivePropertyCtrl*>(m_pPropertyGridCtrl)->ExpandSubKey(*pItem, "", 1);
}
}

if ( bUpdated )
dynamic_cast<CArchivePropertyCtrl*>(m_pPropertyGridCtrl)->PropertyStoreSynchronize();
__super::ItemExpand(hTreeItem, nActionTVE, bRedraw);
}



this is the assert call stack:
>    ProfUIS281md.dll!CExtGridBaseWnd::EnsureVisibleRow(long nRowNo=-1, bool bRedraw=true) Line 6017 + 0x17 bytes    C++
    ProfUIS281md.dll!CExtTreeGridWnd::ItemEnsureVisibleBranch(_TREEITEM * hTreeItem=0x06f890a8, bool bRedraw=true) Line 3649 + 0x1a bytes    C++
    ProfUIS281md.dll!CExtTreeGridWnd::ItemExpand(_TREEITEM * hTreeItem=0x06f890a8, int nActionTVE=2, bool bRedraw=true) Line 3624 + 0x1a bytes    C++
    ProfUIS281md.dll!CExtPropertyGridWnd::ItemExpand(_TREEITEM * hTreeItem=0x06f890a8, int nActionTVE=2, bool bRedraw=true) Line 7320    C++
    GuiMdi.exe!CArchivePropertyCtrl::CExtPropertyGridWndCategorizedArc::ItemExpand(_TREEITEM * hTreeItem=0x06f890a8, int nActionTVE=2, bool bRedraw=true) Line 750 + 0x17 bytes    C++
    ProfUIS281md.dll!CExtPropertyItem::OnGridRowInitialized(CExtPropertyGridWnd & wndPG={...}, _TREEITEM * hTreeItem=0x06f890a8, CExtGridCell * pCellCaption=0x06fafea8, CExtGridCell * pCellValue=0x06fafef8) Line 838 + 0x1a bytes    C++
    ProfUIS281md.dll!CExtPropertyGridWnd::PropertyItemInsert(CExtPropertyItem * pPropertyItem=0x06fa7110, long nIndex=9, _TREEITEM * htiParent=0x06f88c70, bool bRedraw=false) Line 6741 + 0x22 bytes    C++
    ProfUIS281md.dll!CExtPropertyGridWnd::PropertyItemInsertAlphabetic(CExtPropertyItem * pPropertyItem=0x06fa7110, _TREEITEM * htiParent=0x06f88c70, bool bRedraw=false) Line 6788 + 0x22 bytes    C++
    ProfUIS281md.dll!CExtPropertyGridWnd::PropertyStoreSynchronizeOneLevel(CExtPropertyItem * pPropertyItem=0x06fa7110, CExtPropertyItem * pParentItem=0x0470c280) Line 6571 + 0x1c bytes    C++
    ProfUIS281md.dll!CExtPropertyGridWnd::PropertyStoreSynchronizeOneLevel(CExtPropertyItem * pPropertyItem=0x0470c280, CExtPropertyItem * pParentItem=0x0470ccc0) Line 6629 + 0x1a bytes    C++
    ProfUIS281md.dll!CExtPropertyGridWnd::PropertyStoreSynchronizeOneLevel(CExtPropertyItem * pPropertyItem=0x0470ccc0, CExtPropertyItem * pParentItem=0x045fe758) Line 6629 + 0x1a bytes    C++
    ProfUIS281md.dll!CExtPropertyGridWnd::PropertyStoreSynchronizeOneLevel(CExtPropertyItem * pPropertyItem=0x045fe758, CExtPropertyItem * pParentItem=0x00000000) Line 6629 + 0x1a bytes    C++
    ProfUIS281md.dll!CExtPropertyGridWnd::PropertyStoreSynchronizeAll() Line 6501 + 0x18 bytes    C++
    ProfUIS281md.dll!CExtPropertyGridCtrl::PropertyStoreSynchronize() Line 9417 + 0x12 bytes    C++
    ProfUIS281md.dll!CExtPropertyGridCtrl::PropertyStoreSet(CExtPropertyStore * pPS=0x045fe758) Line 9444 + 0x12 bytes    C++
    ProfUIS281md.dll!CExtPropertyGridComboBoxBar::_SynchronizeCurSel() Line 7759 + 0x16 bytes    C++
    ProfUIS281md.dll!CExtPropertyGridComboBoxBar::PropertyStoreInsert(CExtPropertyStore * pPropertyStore=0x045fe758, int nPos=0) Line 7684 + 0x12 bytes    C++
    GuiMdi.exe!CArchivePropertyCtrl::ShowArchive(const CArchivePropertyCtrl::PropertiesInfo & pi={...}) Line 230 + 0x18 bytes    C++

Technical Support Feb 9, 2008 - 1:24 AM

Yes, and we can provide you with the latest stable version 2.83. You can download it from our ftp server. Send us a request for details by email.


Ian McIntosh Feb 7, 2008 - 5:05 AM

Will this change be incorporated in future versions of prof-uis?

Technical Support Jan 31, 2008 - 4:20 AM

The following version is more correct because nRowOffset is a zero based row index in the grid:

      if( nRowOffset < rcVisibleRange.top )
      {
            if( nRowOffset >= 0 )
                  EnsureVisibleRow( nRowOffset, bRedraw );
            return;
      }