Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - Multiline header editing. Visual goof fix.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Multiline header editing. Visual goof fix.

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

Joined: 08 January 2007
Location: United States
Status: Offline
Points: 217
Post Options Post Options   Thanks (1) Thanks(1)   Quote Algae Quote  Post ReplyReply Direct Link To This Post Topic: Multiline header editing. Visual goof fix.
    Posted: 13 March 2016 at 4:35pm
This issue has been around for a long, long time but I ran into a situation where I required a fix.

A body section row edits and sizes without trouble. A header section row does not!

The problem is that when you edit a multiline Header row the edited cell does not update visually. The cell will not accommodate your entry properly because the layout does not change automatically.

First, the non-obvious steps to make a multiline Header row. Set up the column options:
(m_align will be whatever you want.. center, left, right)
  1. pColumn->SetAlignment(m_align | xtpColumnTextWordBreak | xtpColumnTextVCenter);
  2. pColumn->EnableResize(TRUE);
  3. pColumn->GetEditOptions()->m_dwEditStyle |= ES_MULTILINE | ES_AUTOVSCROLL;

*Please note that header/footer sections do not have their own column structures, edit controls and so forth. Everything under every column in every section behaves the same way.

Then fix the header cell size after edit:

1. Set up a notify message:

ON_NOTIFY(XTP_NM_REPORT_VALUECHANGED, XTP_ID_REPORT_CONTROL, OnReportValueChanged)

2. Set up the handler:

void CMyReportView::OnReportValueChanged(NMHDR * pNotifyStruct, LRESULT*)
{
    XTP_NM_REPORTRECORDITEM* pItemNotify = (XTP_NM_REPORTRECORDITEM*) pNotifyStruct;

    if(!pItemNotify)
        return;

    if(pItemNotify->pRow->GetType() == xtpRowTypeHeader)
    {
        if(pItemNotify->pItem)
        {
            GetReportCtrl().AdjustLayout();
        }
    }
}

The call to AdjustLayout fixes the new cell size properly.

Hopefully this will help simplify the process.

V. 16.26.
I believe V. 17.1 has same problem.
Back to Top
olebed View Drop Down
Admin Group
Admin Group


Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post Posted: 14 March 2016 at 2:47pm
Hello Algae,

I think we fixed this issue in version 17.0.

I have check this behavior in last version (17.1)  with ReportSample -> MergeTest. And I didn't notice any troubles. Except I could not get multiline InplaceEdit.  After using your settings I could edit cells  (long text was added) in footer section  and  row's high are changed after finish editing with [Enter].

Setting text with code after creation and population gives the same good result.

CXTPReportRecord* pRecord = GetReportCtrl().GetSections()->GetAt(xtpReportSectionHeader)->GetRecords()->GetAt(0);

CXTPReportRecordItemText* pItem = DYNAMIC_DOWNCAST(CXTPReportRecordItemText, pRecord->GetItem(5));

 pItem->SetValue(_T("verry verry verry long caption"));
// without calling redrawing of report control

Regards,
 Oleksandr Lebed
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.125 seconds.