Adding a row to a collapsed CXTPReportControl |
Post Reply |
Author | |
acwest
Groupie Joined: 23 April 2010 Location: Canada Status: Offline Points: 16 |
Post Options
Thanks(0)
Posted: 10 May 2010 at 5:15pm |
In our application, we have a CXTPReportControl containing a potentially large number of rows. The problem I am having is that it appears that when a row is added into the tree, if the user has collapsed the tree, it gets expanded automatically. I would like to prevent this from happening. I put some breakpoints in the code, and CXTPReportRow::SetExpanded does not appear to be called...
-Craig |
|
acwest
Groupie Joined: 23 April 2010 Location: Canada Status: Offline Points: 16 |
Post Options
Thanks(0)
|
So does anybody have any ideas on why my control is being expanded? Does anybody else have the same behavior?
|
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
Hi,
I am using ActiveX but I think it has same problem... Call Populate automatically expands all collapsed rows.
And to all other MFC users, why don't you reply on this? Only nagging about bugs/problems isn't what a forum is about, helping your fellow users thats what's a forum is for !!!!
|
|
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2 Language: Visual Basic 6.0 Zero replies is not an option.... |
|
acwest
Groupie Joined: 23 April 2010 Location: Canada Status: Offline Points: 16 |
Post Options
Thanks(0)
|
I have just updated my project to use the latest version of the toolkit (13.4.2) and still see the same behaviour. Is there any way to have collapsed rows NOT expand?
|
|
Sneemaster
Newbie Joined: 29 November 2010 Status: Offline Points: 1 |
Post Options
Thanks(0)
|
I am also noticing the same problem. Are there any updates on this? Can we force-collapse the rows after we run the Populate command? If so, how do we determine if the rows were originally collapsed?
|
|
acwest
Groupie Joined: 23 April 2010 Location: Canada Status: Offline Points: 16 |
Post Options
Thanks(0)
|
My solution, if you can call it that, was to subclass the report control, and in my populate, get a list of all collapsed rows, then recollapse them, unless they contained new records, in which case, leave them expanded
CSubclassReportControl { ... std::list<CXTPReportRecord*> m_NewRecords; CXTPReportRecord* AddRecord(CXTPReportRecord* pRecord) { POSITION pos = m_NewRecords.Find(pRecord); if (!pos) m_NewRecords.AddTail(pRecord); return __super::AddRecord(pRecord); } void Populate() { CList<CString> collapsedRows; CXTPReportRows *pRows = GetRows(); for (int i = 0; i < pRows->GetCount(); i++) { CXTPReportRow *pRow = pRows->GetAt(i); if (pRow && pRow->IsGroupRow() && !pRow->IsExpanded()) { CXTPReportGroupRow* pGroupRow = (CXTPReportGroupRow*) pRow; collapsedRows.AddTail(pGroupRow->GetCaption()); } } __super::Populate(); pRows = GetRows(); for (int i = 0; i < pRows->GetCount(); i++) { CXTPReportRow *pRow = pRows->GetAt(i); if (pRow && pRow->IsGroupRow()) { CXTPReportGroupRow* pGroupRow = (CXTPReportGroupRow*) pRow; CString caption = pGroupRow->GetCaption(); POSITION pos = collapsedRows.Find(caption); if (pos) { bool foundNew = false; CXTPReportRows *pChilds = pRow->GetChilds(); for (int j = 0; j < pChilds->GetCount(); j++) { CXTPReportRow *pChild = pChilds->GetAt(j); if (pChild) { CXTPReportRecord* pRecord = pChild->GetRecord(); POSITION pos = m_NewRecords.Find(pRecord); if (pos) { m_NewRecords.RemoveAt(pos); foundNew = true; break; } } } if (!foundNew) { pGroupRow->SetExpanded(FALSE); } collapsedRows.RemoveAt(pos); } } } m_NewRecords.RemoveAll(); } }; |
|
ABuenger
Newbie Joined: 02 February 2006 Status: Offline Points: 1075 |
Post Options
Thanks(0)
|
Hi,
currently Populate() does not keep the current expand state. All rows are destroyed and the recreated. I look into a solution for the next release. Andre |
|
Codejock support
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |