Print Page | Close Window

Selection Change NOTIFY

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=2949
Printed Date: 29 March 2024 at 3:45am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Selection Change NOTIFY
Posted By: umcbrad
Subject: Selection Change NOTIFY
Date Posted: 27 September 2005 at 11:53am

How do I pick up the action of the highlited row changing in a  CXTPReportControl?

Basically, the equivelant of OnSelChange() for a CListBox?

Thanks,

Brad




Replies:
Posted By: sserge
Date Posted: 28 September 2005 at 3:06am
Hi Brad,

There is an overridable method: virtual void CXTPReportControl::OnSelectionChanged()
which sends XTP_NM_REPORT_SELCHANGED notify message to an owner.

Also see XTPReportDefines.h for more report notifications.

--
WBR,
Serge


Posted By: umcbrad
Date Posted: 28 September 2005 at 11:10am

I've got the following code in my program.  OnReportItemClick works fine, and the pRow member is always the row at the index of the row clicked, but in the other handler, the pRow member is always the row from index zero, and thus, GetIndex() returns zero, instead of the correct index. 

What am I doing wrong?

ON_NOTIFY(NM_CLICK, IDC_RPT, OnReportItemClick)
ON_NOTIFY(XTP_NM_REPORT_SELCHANGED, IDC_RPT, OnSelectionChanged)

void CUnicorMedDlg::OnReportItemClick(NMHDR * pNotifyStruct, LRESULT * /*result*/)
{
 XTP_NM_REPORTRECORDITEM* pItemNotify = (XTP_NM_REPORTRECORDITEM*) pNotifyStruct;

 if (pItemNotify->pRow)
  int idx = pItemNotify->pRow->GetIndex();
}

void CUnicorMedDlg::OnSelectionChanged(NMHDR * pNotifyStruct, LRESULT * /*result*/)
{
 XTP_NM_REPORTRECORDITEM* pItemNotify = (XTP_NM_REPORTRECORDITEM*) pNotifyStruct;

 if (pItemNotify->pRow)
  int idx = pItemNotify->pRow->GetIndex();
}



Posted By: sserge
Date Posted: 29 September 2005 at 1:31am
Yes, for the XTP_NM_REPORT_SELCHANGED message pNotifyStruct is NMHDR only.

You shouldn't convert it to XTP_NM_REPORTRECORDITEM.
Unfortunately, there is a mistake in documentation.

Multiple rows can be selected/unselected at one time and
the message with a single row index will not be sent.

You have to use CXTPReportControl::GetSelectedRows() method to retrieve a new selected rows collection.

--
WBR,
Serge



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