Print Page | Close Window

XTP_NM_REPORT_SORTORDERCHANGED crash

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=15532
Printed Date: 21 November 2024 at 2:42pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: XTP_NM_REPORT_SORTORDERCHANGED crash
Posted By: znakeeye
Subject: XTP_NM_REPORT_SORTORDERCHANGED crash
Date Posted: 02 November 2009 at 10:39am
Using 12.0.1. Same code for 13.2...
 
From source comments:
 
This is what the DOCUMENTATION SAYS:
// BEGIN_MESSAGE_MAP(CReportSampleView, CXTPReportView)
//     ON_NOTIFY(XTP_NM_REPORT_SORTORDERCHANGED, XTP_ID_REPORT_CONTROL, OnReportSortOrderChanged)
// END_MESSAGE_MAP()
//
// void CReportSampleView::OnReportSortOrderChanged(NMHDR*  pNotifyStruct, LRESULT* /*result*/)
// {
//     XTP_NM_REPORTRECORDITEM* pItemNotify = (XTP_NM_REPORTRECORDITEM*) pNotifyStruct;
//     ASSERT(pItemNotify != NULL);
//
//     // TODO: Handle command.
// }
 
From source:
This is what the CODE DOES:
m_pControl->SendNotifyMessage(XTP_NM_REPORT_PRESORTORDERCHANGED); // Second parameter is NULL!
 
 
LRESULT CXTPReportControl::SendNotifyMessage(UINT nMessage, NMHDR* pNMHDR) const <------ NULL!
{
 if (!IsWindow(m_hWnd))
  return 0;
 NMHDR nmhdr;
 if (pNMHDR == NULL)
  pNMHDR = &nmhdr; <---------- assignment!
 pNMHDR->hwndFrom = GetSafeHwnd();
 pNMHDR->idFrom = GetDlgCtrlID();
 pNMHDR->code = nMessage;
 CWnd *pOwner = GetOwner();
 if (pOwner && IsWindow(pOwner->m_hWnd))
  return pOwner->SendMessage(WM_NOTIFY, pNMHDR->idFrom, (LPARAM)pNMHDR); <--- NOT the struct we expect!
 else
  return 0;
}
 
WM_NOTIFY does NOT send a XTP_NM_REPORTRECORDITEM struct for XTP_NM_REPORT_PRESORTORDERCHANGED message! So you will get a CRASH!
 
 
It's a bug. Period. End of discussion. Please fix it.


-------------
PokerMemento - http://www.pokermemento.com/



Replies:
Posted By: mdoubson
Date Posted: 02 November 2009 at 11:46am
piece of XTPRecordHeader.cpp file ver 12.1:
m_pControl->SendNotifyMessage(XTP_NM_REPORT_PRESORTORDERCHANGED);

if (bGroupOrderChanged)

m_pControl->Populate();

else

m_pControl->ReSortRows();

m_pControl->SendNotifyMessage(XTP_NM_REPORT_SORTORDERCHANGED);



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


Posted By: znakeeye
Date Posted: 04 November 2009 at 11:28am
FACT: My post shows a bug OR erroneous documentation.
 
You obviously did not read it.


-------------
PokerMemento - http://www.pokermemento.com/


Posted By: mdoubson
Date Posted: 08 November 2009 at 11:28am
No, I do. You can use derived classes with extra details used

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



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