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

Selection Change NOTIFY

 Post Reply Post Reply
Author
Message
umcbrad View Drop Down
Newbie
Newbie


Joined: 26 April 2005
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote umcbrad Quote  Post ReplyReply Direct Link To This Post Topic: Selection Change NOTIFY
    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

Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
umcbrad View Drop Down
Newbie
Newbie


Joined: 26 April 2005
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote umcbrad Quote  Post ReplyReply Direct Link To This Post 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();
}



Edited by umcbrad
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post 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
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.172 seconds.