Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - Possible BUG in CXTPReportRow::GetItemMetrics
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Possible BUG in CXTPReportRow::GetItemMetrics

 Post Reply Post Reply
Author
Message
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1201
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Topic: Possible BUG in CXTPReportRow::GetItemMetrics
    Posted: 16 September 2009 at 4:05pm
Hi;

I used to dynamically set icon alignment in report rows by providing it in my own CXTPReportRecord derived GetItemMetrics() function but I never got it to work. After a few minutes of debugging I found this in CXTPReportRow::GetItemMetrics
void CXTPReportRow::GetItemMetrics(XTP_REPORTRECORDITEM_DRAWARGS* pDrawArgs, XTP_REPORTRECORDITEM_METRICS* pItemMetrics)
{
    ASSERT(m_pRecord);
    ASSERT(pDrawArgs->pRow == this);
    ASSERT(pDrawArgs->pItem != NULL);
    if (!m_pRecord || !pDrawArgs->pItem)
        return;

    CXTPReportPaintManager* pPaintManager = pDrawArgs->pControl->GetPaintManager();

    pItemMetrics->pFont = &pPaintManager->m_fontText;
    pItemMetrics->clrForeground = pPaintManager->m_clrWindowText;
    pItemMetrics->clrBackground = XTP_REPORT_COLOR_DEFAULT;
    pItemMetrics->nColumnAlignment = pDrawArgs->nTextAlign;
    pItemMetrics->nItemIcon = XTP_REPORT_NOICON;

    m_pRecord->GetItemMetrics(pDrawArgs, pItemMetrics);      <-- Here I set my own alignment...
    pDrawArgs->pItem->GetItemMetrics(pDrawArgs, pItemMetrics);

    m_pControl->GetItemMetrics(pDrawArgs, pItemMetrics);
    pDrawArgs->nTextAlign = pItemMetrics->nColumnAlignment;   <-- ... and here everything is reset!
   ...


So, settings applied in my CXTPReportRecord derived class' GetItemMetrics are alwys overwritten!
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 16 September 2009 at 5:01pm
What's happened if you comment this (red) line?
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1201
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 16 September 2009 at 5:58pm
I'll try it and will reply tomorrow!
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022
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.188 seconds.