Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - XTP_NM_REPORT_SORTORDERCHANGED crash
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

XTP_NM_REPORT_SORTORDERCHANGED crash

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

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Topic: XTP_NM_REPORT_SORTORDERCHANGED crash
    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/
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: 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);

Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post 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/
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: 08 November 2009 at 11:28am
No, I do. You can use derived classes with extra details used
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.