Print Page | Close Window

Multiple lines for 1 logical row

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=6842
Printed Date: 22 November 2024 at 7:53am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Multiple lines for 1 logical row
Posted By: mungerer
Subject: Multiple lines for 1 logical row
Date Posted: 11 April 2007 at 3:59pm
Hi-
 
I know that you can wrap text using DT_WORDBREAK, but is it possible to always show some of a rows column data underneath other column data?
 
For example:
 
---------------------------------------------
ROW1    Date1 Time1
            Subject1                      Attachment1
---------------------------------------------
ROW2    Date2 Time2
            Subject2                      Attachment2
---------------------------------------------
ROW3    Date3 Time3
            Subject3                      Attachment3
---------------------------------------------
 
... etc?  It doesn't look like the control handles this situation out of the box, but what exactly needs to be customized to accomplish this effect?
 
Thanks,
-Matt



Replies:
Posted By: JohnCrenshaw
Date Posted: 12 April 2007 at 7:25pm
You'll need a custom paint manager, and custom items in your record.
 
Paint manager is so you can do something like this:
class CMyReportPaintManager : public CXTPReportPaintManager
{
public:
   CMyReportPaintManager() {}
   ~CMyReportPaintManager() {}
 
   virtual int GetRowHeight(CDC* pDC, CXTPReportRow* pRow)
   {
      if (HasMultirowItems(pRow))
      {
         ...Calculate the height of the tallest item in the record...;
         return nCalculatedHeight
      }
      return CXTPReportPaintManager::GetRowHeight(pDC, pRow);
   }
   virtual int GetRowHeight(CDC* pDC, CXTPReportRow* pRow, int nTotalWidth)
   {
      if (HasMultirowItems(pRow))
      {
         ...Calculate the height of the tallest item in the record...;
         return nCalculatedHeight
      }
      return CXTPReportPaintManager::GetRowHeight(pDC, pRow, nTotalWidth);
   }
};
 
The custom items will draw themselves
 
class CMyRecordItem : public CXTPReportRecordItemText
{
   DECLARE_DYNAMIC(CSidebarRecordItem);
public:
   CMyRecordItem(LPCTSTR sz) : CXTPReportRecordItemText(sz) {}
   ~CMyRecordItem() {}
 
   virtual int Draw(XTP_REPORTRECORDITEM_DRAWARGS* pDrawArgs)
   {
      // See the draw code in XTPReportRecordItem.cpp line 295
      // this code will provide a base for the rest of this
   }
};
 
That's a general direction for you anyway. There might be a better angle on this (for example, you might get the measuring to happen automatically just by overriding some stuff in the item) but that should get you started.


Posted By: mungerer
Date Posted: 12 April 2007 at 8:49pm
Thanks John!



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net