GetSelectedConstraintData question |
Post Reply |
Author | |
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
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/
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
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/
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
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;} |
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Thanks!
|
|
PokerMemento - http://www.pokermemento.com/
|
|
gopalreddy_g
Newbie Joined: 02 May 2009 Status: Offline Points: 3 |
Post Options
Thanks(0)
|
hi
what is the equivalent code to do the same in Vb.Net
Gopal
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |