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

GetSelectedConstraintData question

 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: GetSelectedConstraintData question
    Posted: 07 January 2009 at 10:47am
I handle XTP_NM_REPORT_VALUECHANGED. Inside my handler I want to retrieve the data of the selected constraint.
 
GetSelectedConstraintData always returns -1. Is this a bug? How do I get the associated data?
 
(I know I can loop through the constraints and compare their string values, but that is very ugly and not reliable.)
PokerMemento - http://www.pokermemento.com/
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: 09 January 2009 at 7:19am
I really need help with this. In OnReportValueChanged(...):
 
// TODO: It should be possible to get the constraint data without string comparison!
   BOOL isEnabled = FALSE;
   int numberConstraints = pItemNotify->pColumn->GetEditOptions()->GetConstraints()->GetCount();
   for (int i = 0; i < numberConstraints; ++i)
   {
    CXTPReportRecordItemConstraint* pConstraint = pItemNotify->pColumn->GetEditOptions()->GetConstraints()->GetAt(i);
    if (pItemString->GetValue() == pConstraint->m_strConstraint)
    {
     isEnabled = static_cast<BOOL>(pConstraint->m_dwData);
     break;
    }
   }
 
It should be possible to get the constraint data immediately, without this ugly code! Any ideas?
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: 09 January 2009 at 11:53am
base class function
AFX_INLINE DWORD CXTPReportRecordItem::GetSelectedConstraintData(XTP_REPORTRECORDITEM_ARGS* /*pItemArgs*/) {
return DWORD(-1);} - do nothing, derived class can do that you wants - see function
DWORD CXTPReportRecordItemVariant::GetSelectedConstraintData(XTP_REPORTRECORDITEM_ARGS* pItemArgs)
example - in TaskListView from ReportSample app

class CTaskItemImportance : public CXTPReportRecordItem

{

public:

CTaskItemImportance(TaskImportance taskImportance){SetImportance(taskImportance);}

void OnConstraintChanged(XTP_REPORTRECORDITEM_ARGS* /*pItemArgs*/, CXTPReportRecordItemConstraint* pConstraint){SetImportance((TaskImportance)pConstraint->m_dwData);}

DWORD GetSelectedConstraintData(XTP_REPORTRECORDITEM_ARGS* /*pItemArgs*/){return m_taskImportance;}

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: 12 January 2009 at 3:12am
Thanks!
PokerMemento - http://www.pokermemento.com/
Back to Top
gopalreddy_g View Drop Down
Newbie
Newbie


Joined: 02 May 2009
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote gopalreddy_g Quote  Post ReplyReply Direct Link To This Post Posted: 02 May 2009 at 9:47pm
hi
 
what is the equivalent code to do the same in Vb.Net
 
Gopal
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.203 seconds.