Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - Adding a row to a collapsed CXTPReportControl
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Adding a row to a collapsed CXTPReportControl

 Post Reply Post Reply
Author
Message
acwest View Drop Down
Groupie
Groupie


Joined: 23 April 2010
Location: Canada
Status: Offline
Points: 16
Post Options Post Options   Thanks (0) Thanks(0)   Quote acwest Quote  Post ReplyReply Direct Link To This Post Topic: Adding a row to a collapsed CXTPReportControl
    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
Back to Top
acwest View Drop Down
Groupie
Groupie


Joined: 23 April 2010
Location: Canada
Status: Offline
Points: 16
Post Options Post Options   Thanks (0) Thanks(0)   Quote acwest Quote  Post ReplyReply Direct Link To This Post Posted: 14 May 2010 at 4:59pm
So does anybody have any ideas on why my control is being expanded? Does anybody else have the same behavior?
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Posted: 25 May 2010 at 3:25pm
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....
Back to Top
acwest View Drop Down
Groupie
Groupie


Joined: 23 April 2010
Location: Canada
Status: Offline
Points: 16
Post Options Post Options   Thanks (0) Thanks(0)   Quote acwest Quote  Post ReplyReply Direct Link To This Post Posted: 03 November 2010 at 4:25pm
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? 
Back to Top
Sneemaster View Drop Down
Newbie
Newbie


Joined: 29 November 2010
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote Sneemaster Quote  Post ReplyReply Direct Link To This Post Posted: 29 November 2010 at 12:32pm
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?
Back to Top
acwest View Drop Down
Groupie
Groupie


Joined: 23 April 2010
Location: Canada
Status: Offline
Points: 16
Post Options Post Options   Thanks (0) Thanks(0)   Quote acwest Quote  Post ReplyReply Direct Link To This Post Posted: 17 May 2011 at 4:32pm
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();
    }
};
Back to Top
ABuenger View Drop Down
Newbie
Newbie
Avatar

Joined: 02 February 2006
Status: Offline
Points: 1075
Post Options Post Options   Thanks (0) Thanks(0)   Quote ABuenger Quote  Post ReplyReply Direct Link To This Post Posted: 19 May 2011 at 9:10am
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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.