Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - Multiline rows in Virtual mode
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Multiline rows in Virtual mode

 Post Reply Post Reply
Author
Message
stiff upper lip View Drop Down
Newbie
Newbie


Joined: 17 June 2006
Location: Russian Federation
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote stiff upper lip Quote  Post ReplyReply Direct Link To This Post Topic: Multiline rows in Virtual mode
    Posted: 17 June 2006 at 10:02am
hi
 
How I can use different height for different rows in virtual mode , I use extreme report control in virtual mode to read data from access data base , I tried to do the same as report control sample , means , to create a new class  CReportMultilinePaintManager  , and override the

CReportMultilinePaintManager::GetRowHeight( ....) function , but it wont work:( , Cry , can you help me to get over this problem

 
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post Posted: 17 June 2006 at 3:36pm
Back to Top
stiff upper lip View Drop Down
Newbie
Newbie


Joined: 17 June 2006
Location: Russian Federation
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote stiff upper lip Quote  Post ReplyReply Direct Link To This Post Posted: 20 June 2006 at 4:50am
I wanted to use the same CReportMultilinePaintManager class used in the reportcontrol sample , here is the code :
 

int CReportMultilinePaintManager::GetRowHeight(CDC* pDC, CXTPReportRow* pRow)

{

if (pRow->IsGroupRow() || !pRow->IsItemsVisible())

return CXTPReportPaintManager::GetRowHeight(pDC, pRow);

CXTPReportColumns* pColumns = pRow->GetControl()->GetColumns();

int nColumnCount = pColumns->GetCount();

XTP_REPORTRECORDITEM_DRAWARGS drawArgs;

drawArgs.pControl = pRow->GetControl();

drawArgs.pDC = pDC;

drawArgs.pRow = pRow;

int nHeight = 0;

for (int nColumn = 0; nColumn < nColumnCount; nColumn++)

{

CXTPReportColumn* pColumn = pColumns->GetAt(nColumn);

if (pColumn && pColumn->IsVisible())

{

CXTPReportRecordItem* pItem = pRow->GetRecord()->GetItem(pColumn);

drawArgs.pItem = pItem;

XTP_REPORTRECORDITEM_METRICS itemMetrics;

pRow->GetItemMetrics(&drawArgs, &itemMetrics);

CXTPFontDC fnt(pDC, itemMetrics.pFont);

CRect rcItem(0, 0, pColumn->GetWidth() - 4, 0);

pRow->ShiftTreeIndent(rcItem, pColumn);

pItem->GetCaptionRect(&drawArgs, rcItem);

pDC->DrawText(pItem->GetCaption(pColumn), rcItem, DT_WORDBREAK|DT_CALCRECT);

nHeight = max(nHeight, rcItem.Height());

}

}

return max(nHeight + 5, m_nRowHeight) + (IsGridVisible(FALSE)? 1: 0);

}

but when I added this class to my program , it seems that pItem->GetCaption(pColumn)  always return an emptry string , and consequently GetRowHeight return 0 ,

is there another way to access my CXTPReportRecordItem and retreive the item text ?
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post Posted: 25 June 2006 at 5:14pm
When you do use Virtual records, do not forget that actual text for an item is set after calling GetItemMetrics(...) method . So far, changing pItem->GetCaption(pColumn) in this code to itemMetrics.strText should help.

--
WBR,
Serge
Back to Top
stiff upper lip View Drop Down
Newbie
Newbie


Joined: 17 June 2006
Location: Russian Federation
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote stiff upper lip Quote  Post ReplyReply Direct Link To This Post Posted: 26 June 2006 at 6:25am
hello sserge
 
thank you for the tip Smile ,  i have replaced pItem->GetCaption(pColumn)
with itemMetrics.strText , then you have to add the following code to make it working ,
you have to add :
 
drawArgs.pColumn = pColumn;
before you call :
pRow->GetItemMetrics(&drawArgs, &itemMetrics);
 
now it working fine , thanks again
 
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.172 seconds.