Print Page | Close Window

Indent Problem

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=13878
Printed Date: 12 May 2024 at 1:22am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Indent Problem
Posted By: securigy
Subject: Indent Problem
Date Posted: 31 March 2009 at 2:11pm
https://forum.codejock.com/uploads/20090331_140145_Codekock-12-1-I.zip -
The ident of the rows does not display correctly, it corrects itself only when I click on the sort header of the Name column
 
see screenshot below (records/rows do not have correct ident). Is there anyway to fix it? Is it a bug in reportctrl or something that I am not doing right?
 
uploads/20090331_140145_Codekock-12-1-I.zip
 
========================
the code:
 
in CReportCtrl::OnInitDialog, I have:

m_wndReportCtrl.SetTreeIndent(10);

m_wndReportCtrl.AddColumn(new CXTPReportColumn(COLUMN_ICON, L"", 18, FALSE, ICON_ICON_IDX));

m_wndReportCtrl.AddColumn(new CXTPReportColumn(COLUMN_CHECK, L"", 18, FALSE, CHECK_ICON_IDX));

CString csStr;

csStr.LoadString(IDS_DEVICE_TYPE_MAJOR);

m_wndReportCtrl.AddColumn(new CXTPReportColumn(COLUMN_DEVTYPE, csStr, 280));

csStr.LoadString(IDS_DEVICE_TYPE_MINOR);

m_wndReportCtrl.AddColumn(new CXTPReportColumn(COLUMN_DEVSUBTYPE, csStr, 280));

 

m_wndReportCtrl.ShowGroupBy();

m_wndReportCtrl.GetColumns()->GetGroupsOrder()->Add(m_wndReportCtrl.GetColumns()->GetAt(COLUMN_DEVTYPE));

m_wndReportCtrl.GetColumns()->GetGroupsOrder()->Add(m_wndReportCtrl.GetColumns()->GetAt(COLUMN_DEVSUBTYPE));

m_wndReportCtrl.GetColumns()->GetAt(COLUMN_DEVTYPE)->SetVisible(FALSE);

m_wndReportCtrl.GetColumns()->GetAt(COLUMN_DEVSUBTYPE)->SetVisible(FALSE);




Replies:
Posted By: mdoubson
Date Posted: 01 April 2009 at 11:04pm

Do you try to call ShowGroupBy after Populate call? Same for GetGroupOrder()->Add calls?

Also you need to check current version (13.1) - here you can get static app to try: https://forum.codejock.com/uploads/DemoVersion/ReportSampleSatic.rar - https://forum.codejock.com/uploads/DemoVersion/ReportSampleSatic.rar


-------------
Mark Doubson, Ph.D.


Posted By: securigy
Date Posted: 02 April 2009 at 12:51pm
are you saying the the order of the calls is not correct? if that's the case what should it be? populating the control with data comes way later when I have the data. actually, the problem is not with the ident of the group and subgroup - they are indented fine... the problem is that the data that I gather later and add to a subgroup is not indented... - pls see the file that I uploaded (link is in my original post)


Posted By: mdoubson
Date Posted: 02 April 2009 at 12:54pm
You uploaded file based on old version. Please re-run with current and we can talk later. I propose also call layout adjustment after populate - why don't try it?
 
I also don't know how you add new records as child records? Need code to check. But refresh all to current version first


-------------
Mark Doubson, Ph.D.


Posted By: securigy
Date Posted: 02 April 2009 at 1:51pm
I requested v13.1 and waiting for response. Meanwhile I tried this after adding each record:

if(pMsg)

     this->SendMessage(WM_ADD_RECORD_EX, (WPARAM)pMsg, 0);

SetTreeIndent(10);

AdjustLayout();

RedrawWindow(0, 0, RDW_ALLCHILDREN|RDW_INVALIDATE);

neither of it helps.



Posted By: mdoubson
Date Posted: 02 April 2009 at 2:23pm
run recommended sample. from menu call TreeView Dlg - see how indenting done for subject items - click on expand little button to see. I can give you the code for this dialog

-------------
Mark Doubson, Ph.D.


Posted By: securigy
Date Posted: 02 April 2009 at 2:46pm
the code sample will certainly help.


Posted By: mdoubson
Date Posted: 02 April 2009 at 2:50pm
This is a demo to add new child records run-time on mouse r-click on report row

afx_msg void OnReportRClick(NMHDR * pNotifyStruct, LRESULT * result);

ON_NOTIFY(NM_RCLICK, IDC_REPORT, OnReportRClick)

void CTreeViewDlg::OnReportRClick(NMHDR * pNotifyStruct, LRESULT * /*result*/){

XTP_NM_REPORTRECORDITEM* pItemNotify = (XTP_NM_REPORTRECORDITEM*) pNotifyStruct;

if (pItemNotify->pRow)

{

// TRACE(_T("Right click on row %d\n"), pItemNotify->pRow->GetIndex());

COleDateTime odtSent(COleDateTime::GetCurrentTime());

COleDateTime odtCreated(COleDateTime::GetCurrentTime());

COleDateTime odtReceived(COleDateTime::GetCurrentTime());

CString strMessage(" ");

CString strEmpty(" ");

odtSent -= 8;

CMessageRecord* pRec = new CMessageRecord(msgImportanceNormal, TRUE, TRUE,

_T("Somebody"), _T("I Understand!"), odtSent, 24, FALSE, 5.4321,

odtCreated, odtReceived, strEmpty, strEmpty, strMessage,

strEmpty, strEmpty, strEmpty,

strEmpty, strEmpty,

strMessage);

CXTPReportRecord* pNew = pItemNotify->pRow->GetRecord()->GetChilds()->Add(pRec);

if (pNew)

pItemNotify->pRow->SetExpanded(TRUE, TRUE);

m_wndReport.Populate();

}

}



-------------
Mark Doubson, Ph.D.


Posted By: securigy
Date Posted: 02 April 2009 at 4:22pm
here what I discovered: I used AddRecordEx to add records and apparently it does not work correctly.
I switched to AddRrcord + Populate and it works well now.
THank you Mark.



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