Print Page | Close Window

Multiline header editing. Visual goof fix.

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=22958
Printed Date: 23 April 2024 at 3:18pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Multiline header editing. Visual goof fix.
Posted By: Algae
Subject: Multiline header editing. Visual goof fix.
Date 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.



Replies:
Posted By: olebed
Date 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



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