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

Problem with CXTPReportRecordItemDateTime

 Post Reply Post Reply
Author
Message
unknow View Drop Down
Groupie
Groupie
Avatar

Joined: 14 January 2009
Location: Belgium
Status: Offline
Points: 62
Post Options Post Options   Thanks (0) Thanks(0)   Quote unknow Quote  Post ReplyReply Direct Link To This Post Topic: Problem with CXTPReportRecordItemDateTime
    Posted: 15 November 2009 at 1:03pm
Hi. I have a big issue with CXTPReportRecordItemDateTime class;
 
- I am using this class to display the hour within the ReportControl and sort by time range (60,90,120,>120 minutes)
- The problem occurs when I group the column headers with the field corresponding to this item
- the ReportControls reflect the changes and create groups according to the times comparison routine
- IF there is more than 2 groups, when I click an item, or give the focus to another application, the software goes mad, loops indefinitely and loads hundreds of megabytes in memory
- If there is only 1 group (example items with the same time value), the problem doesn't occur.
 
I think the problem comes from the sorting / priority order used by the ReportControl because if the GetGroupCaptionID function just returns -1, I obtain a group for each different value, but... it works!
 
I've tried everything like using SetGroupPriority, SetSortPriority etc... but nothing seems to work..
 
I'm using the exact same class to group by DATE and it works, so I really don't understand what is wrong !?
 
Here's the class, PLEASE any help is greatly appreciated ! I'm thinking about opening a case, but I guess I'm just forgetting to set something !?
 
class CMessageRecordItemTime : public CXTPReportRecordItemDateTime
{
      DECLARE_SERIAL(CMessageRecordItemTime)
public:
      CMessageRecordItemTime(COleDateTime odtValue = COleDateTime::GetCurrentTime());
      virtual int GetGroupCaptionID(CXTPReportColumn* pColumn);
};

 
CMessageRecordItemTime::CMessageRecordItemTime(COleDateTime odtValue)
 : CXTPReportRecordItemDateTime(odtValue)
{
      SetFormatString("%H:%M:%S");
}
 
int CMessageRecordItemTime::GetGroupCaptionID(CXTPReportColumn* /*pColumn*/)
{
      if (m_odtValue.GetStatus() != COleDateTime::valid)
            return IDS_TXTNONE;

      int nLen = (m_odtValue.GetHour()*60) + m_odtValue.GetMinute();
 
      if (nLen > 120)
            return IDS_GROUP_TIME_XXXMIN;
 
      if (nLen > 90)
            return IDS_GROUP_TIME_90MIN;
 
      return IDS_GROUP_TIME_60MIN;
}
 
IDS Values are:
IDS_GROUP_TIME_60MIN = 2003
IDS_GROUP_TIME_90MIN = 2002
IDS_GROUP_TIME_120MIN = 2001
IDS_GROUP_TIME_XXXMIN = 2000
 
Back to Top
unknow View Drop Down
Groupie
Groupie
Avatar

Joined: 14 January 2009
Location: Belgium
Status: Offline
Points: 62
Post Options Post Options   Thanks (0) Thanks(0)   Quote unknow Quote  Post ReplyReply Direct Link To This Post Posted: 16 November 2009 at 6:53pm
Just spend a few hours trying to find the problem, creating new classes etc... without success, until I found that...
 
What makes the reportcontrol goes mad is to group by such a string (loaded with ID from resources) : "Time: > 90 and < 120 minutes"
 
Why is that ??
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.176 seconds.