Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - Multiple lines for 1 logical row
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Multiple lines for 1 logical row

 Post Reply Post Reply
Author
Message
mungerer View Drop Down
Newbie
Newbie
Avatar

Joined: 11 April 2007
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote mungerer Quote  Post ReplyReply Direct Link To This Post Topic: Multiple lines for 1 logical row
    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
Back to Top
JohnCrenshaw View Drop Down
Groupie
Groupie
Avatar

Joined: 08 September 2006
Status: Offline
Points: 65
Post Options Post Options   Thanks (0) Thanks(0)   Quote JohnCrenshaw Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
mungerer View Drop Down
Newbie
Newbie
Avatar

Joined: 11 April 2007
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote mungerer Quote  Post ReplyReply Direct Link To This Post Posted: 12 April 2007 at 8:49pm
Thanks John!
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.203 seconds.