Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - Saving columns
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Saving columns

 Post Reply Post Reply
Author
Message
Staffan V View Drop Down
Newbie
Newbie
Avatar

Joined: 29 March 2007
Location: Sweden
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote Staffan V Quote  Post ReplyReply Direct Link To This Post Topic: Saving columns
    Posted: 29 March 2007 at 7:28am
I have set up a CXTPReportControl and populated the columns (hiding some) and setting their widths, titles and so on. The user may then move around the columns, show some, hide some and change their widths. Is there a way to save the altered settings so I can restor them the next time the user opens the control?
Back to Top
Staffan V View Drop Down
Newbie
Newbie
Avatar

Joined: 29 March 2007
Location: Sweden
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote Staffan V Quote  Post ReplyReply Direct Link To This Post Posted: 29 March 2007 at 7:35am
At first I used
    CXTPReportColumns *pReportColumns = m_ReportCtrl.GetColumns();
    for( int f = 0; f < NR_OF_COLUMNS; f++ )
    {
        CXTPReportColumn *pReportColumn = pReportColumns->GetAt(f);
        pReportColumn->SetVisible(false or true);
        pReportColumn->SetWidth( the width );
    }

then I saved them in a simmilar way. The problem is that the user may move around the colums so the old column 3 is now column 5 so that way doesn't work at all.
Back to Top
Staffan V View Drop Down
Newbie
Newbie
Avatar

Joined: 29 March 2007
Location: Sweden
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote Staffan V Quote  Post ReplyReply Direct Link To This Post Posted: 27 September 2007 at 8:03am
Isn't there a way to save what columns are shown and their width?
Ok, what about how to get the data and save it myself?

Hello? Anybody?
Back to Top
Staffan V View Drop Down
Newbie
Newbie
Avatar

Joined: 29 March 2007
Location: Sweden
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote Staffan V Quote  Post ReplyReply Direct Link To This Post Posted: 27 September 2007 at 11:07am
Ah, I managed to figure it out by myself. It was a bit easier than I thought.

All I did was
    CXTPPropExchangeXMLNode px(FALSE, 0, _T("IndexSearch"));
    m_ReportCtrl.DoPropExchange(&px);
    px.SaveToFile(sFilename);

to save and

    CXTPPropExchangeXMLNode px(TRUE, 0, _T("IndexSearch"));
    if( px.LoadFromFile(sFilename) )
        m_ReportCtrl.DoPropExchange(&px);

to load.


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.125 seconds.