Print Page | Close Window

GetSelectedConstraintData question

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=13105
Printed Date: 29 September 2024 at 7:29pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: GetSelectedConstraintData question
Posted By: znakeeye
Subject: GetSelectedConstraintData question
Date 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/



Replies:
Posted By: znakeeye
Date 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/


Posted By: mdoubson
Date 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;}



Posted By: znakeeye
Date Posted: 12 January 2009 at 3:12am
Thanks!

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


Posted By: gopalreddy_g
Date Posted: 02 May 2009 at 9:47pm
hi
 
what is the equivalent code to do the same in Vb.Net
 
Gopal



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