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
|