BCGSoft Forums
BCGSoft Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 BCGControlBar Pro for MFC Forums
 BCGControlBar Bugs and Problems
 CBCGPGridCtrl: problem with merged cells
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

al__ma

1 Posts

Posted - 03/19/2012 :  03:26:07 AM  Show Profile  Reply with Quote
Hi,
I tried to use the CBCGPGridCtrl class as a tree, where some cells can be merged. However, I have immediately got a problem in the following scenario of the grid control creation:
1) Create at least two top-level rows.
2) In the second row, merge some items, for example, all items in the row.
3) Add a subitem to the first top-level row.
4) Call AdjustLayout() method.

As a result, the second top-level row will get a correct new row ID, but it seems that nobody cares to update the merged cells info, so that merged cells info and the row ID become incompatible. The result is ASSERT in the CBCGPGridMergedCells::MarkChanged method and severely incorrect work.

In order to demonstrate this problem, take the BCGPGridExample example and add a single row:
m_wndGridTree.MergeRange(CBCGPGridRange(0, m_wndGridTree.GetRowCount()-1, nColumns-1, m_wndGridTree.GetRowCount()-1), FALSE);

after the row:
pRoot->AddSubItem (pUsers, FALSE);

in the TreeDlg.cpp file. In the running example application, show the tree dialog, scroll it to make the "Users" row visible, and get a plenty of ASSERT's.

Support

2992 Posts

Posted - 04/04/2012 :  04:20:02 AM  Show Profile  Visit Support's Homepage  Reply with Quote
Hello,

As we wrote at HelpDesk, actually this is limitation of the current version. In the current version Merged cells feature together with subrows is not fully supported.

To keep off the ASSERT in the CBCGPGridMergedCells::MarkChanged method please call MergeRange after inserting. Not before the rows have been populated..

If you need to insert items to the grid, which already has merged cells, then you should UnMerge all items before inserting items and merge them back after inserting/deleting. Sometime you may need to call RebuildIndexes () to update indexes.

Sincerely yours,

BCGSoft Technical Support
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To:
BCGSoft Forums © Copyright (c) 1998-2013 BCGSoft Co Ltd Go To Top Of Page
Snitz Forums 2000