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

Progress Column Sort

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


Joined: 07 January 2011
Status: Offline
Points: 36
Post Options Post Options   Thanks (0) Thanks(0)   Quote dalai Quote  Post ReplyReply Direct Link To This Post Topic: Progress Column Sort
    Posted: 07 May 2012 at 5:09pm
added progress column in CXTPReportControl but not sorted correctly?
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1355
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 08 May 2012 at 11:37am
What's you XAML/Markup for the progress bar? Can you make a small sample that I can experiment with?
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6

Back to Top
dalai View Drop Down
Groupie
Groupie


Joined: 07 January 2011
Status: Offline
Points: 36
Post Options Post Options   Thanks (0) Thanks(0)   Quote dalai Quote  Post ReplyReply Direct Link To This Post Posted: 09 May 2012 at 5:06am

ok thanks, not using XAML (maybe this is the problem?) just using the CXTPReportRecordItemProgress class as defined in the ReportCustomDraw sample

CXTPReportRecordItemProgress* pRIP;
cstr.Format(_T("%d%%"), progress, 0);
pRIP = new CXTPReportRecordItemProgress(cstr, RGB(130, 192, 255), 12, 3, 1, 100, 1, progress);
AddItem(pRIP);

Back to Top
dalai View Drop Down
Groupie
Groupie


Joined: 07 January 2011
Status: Offline
Points: 36
Post Options Post Options   Thanks (0) Thanks(0)   Quote dalai Quote  Post ReplyReply Direct Link To This Post Posted: 09 May 2012 at 12:09pm
ReportCustomDraw sample appears to sort ok so I'm obvioulsy missing something?
Back to Top
dalai View Drop Down
Groupie
Groupie


Joined: 07 January 2011
Status: Offline
Points: 36
Post Options Post Options   Thanks (0) Thanks(0)   Quote dalai Quote  Post ReplyReply Direct Link To This Post Posted: 09 May 2012 at 12:39pm
project uploaded ...
uploads/6562/ReportTest.zip
Back to Top
dalai View Drop Down
Groupie
Groupie


Joined: 07 January 2011
Status: Offline
Points: 36
Post Options Post Options   Thanks (0) Thanks(0)   Quote dalai Quote  Post ReplyReply Direct Link To This Post Posted: 11 May 2012 at 8:28am
probably doing something silly but something weird is happening ...
if I use 9,8,7,6 then sort order is 9,8 & 7,6 + 8,9 & 6,7 (which is ok)
 
if I use 100,75,50,5 then sort order is 75,100 & 50,5 + 100,75 & 5,50
 
Back to Top
DazMan View Drop Down
Newbie
Newbie
Avatar

Joined: 30 March 2009
Location: UK
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote DazMan Quote  Post ReplyReply Direct Link To This Post Posted: 11 May 2012 at 11:57am
Think you will find the column is being sorted alphabetically, there are two possible solutions
 
Quick and dirty...
 
Change the format specifier of the caption, to include preceding spaces, as per the following line:
 
    cstr.Format(_T("%3d%%"), progress, 0);
 
 
Or the more elegant...
 
Override the virutal Compare function definined in the base class of your CXTPReportRecordItemProgress class to sort the rows based on the m_nProgressPos member variable, causing the compare to be made numerically.  Code would look something like this:
 
int CXTPReportRecordItemProgress::Compare(CXTPReportColumn*, CXTPReportRecordItem* pItem)
{
    CXTPReportRecordItemProgress* pItemProgress = DYNAMIC_DOWNCAST(CXTPReportRecordItemProgress, pItem);
    if (!pItemProgress)
        return 0;
    if (m_nProgressPos == pItemProgress->m_nProgressPos)
        return 0; 
    if (m_nProgressPos > pItemProgress->m_nProgressPos)
        return 1;
    return -1;
}
Back to Top
dalai View Drop Down
Groupie
Groupie


Joined: 07 January 2011
Status: Offline
Points: 36
Post Options Post Options   Thanks (0) Thanks(0)   Quote dalai Quote  Post ReplyReply Direct Link To This Post Posted: 12 May 2012 at 7:43am
thanks. cstr.Format(_T("%3d%%"), progress, 0); fixed it.
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.152 seconds.