![]() |
InitialSelectionEnable not working |
Post Reply ![]() |
Author | |
adrien ![]() Senior Member ![]() Joined: 30 April 2007 Location: New Zealand Status: Offline Points: 449 |
![]() ![]() ![]() ![]() ![]() Posted: 15 February 2009 at 11:50pm |
Hi
I am setting InitialSelectionEnable(FALSE) on my report control. however if there is nothing selected, and I click in a column header to sort, it selects a random row all by itself, and doesn't send any notification. Adrien |
|
![]() |
|
adrien ![]() Senior Member ![]() Joined: 30 April 2007 Location: New Zealand Status: Offline Points: 449 |
![]() ![]() ![]() ![]() ![]() |
I hacked the report control to fix it.
void CXTPReportControl::ReSortRows() { if (IsVirtualMode()) { Populate(); return; } // are there any selected rows? BOOL bRowsSelected = GetSelectedRows()->GetCount() != 0; SortTree(m_pPlainTree); CXTPReportRecord* pFocusedRecord = GetFocusedRow() ? GetFocusedRow()->GetRecord() : NULL; m_pRows->Clear(); m_arrScreenRows.Clear(FALSE); for (int nGroupRow = 0; nGroupRow < m_pPlainTree->GetCount(); nGroupRow++) { CXTPReportRow* pRow = m_pPlainTree->GetAt(nGroupRow); InsertRow(m_pRows->GetCount(), pRow); pRow->m_nChildIndex = nGroupRow; ASSERT(pRow->m_pParentRows == m_pPlainTree); } //----------------------------------------------------------------------- m_nFocusedRow = -1; // Update indexes on virtual rows int nRowCount = m_pRows->GetCount(); for (int nRowIndex = 0; nRowIndex < nRowCount; nRowIndex++) { CXTPReportRow* pRow = m_pRows->GetAt(nRowIndex); if (pRow) { pRow->SetIndex(nRowIndex); pRow->m_bVisible = TRUE; if (pFocusedRecord && pRow->GetRecord() == pFocusedRecord) { m_nFocusedRow = pRow->GetIndex(); if (IsSelectionEnabled() && bRowsSelected) m_pSelectedRows->Select(pRow); } } } AdjustIndentation(); AdjustLayout(); RedrawControl(); } |
|
![]() |
|
mdoubson ![]() Senior Member ![]() ![]() Joined: 17 November 2008 Status: Offline Points: 1705 |
![]() ![]() ![]() ![]() ![]() |
Good - I check you contribution and with small modifications use it in our source (Release 13.1). Thanks. void CXTPReportControl::ReSortRows(){ ....... BOOL bRowsSelected = m_bInitialSelectionEnable;
if (GetSelectedRows()!= NULL){ if (GetSelectedRows()->GetCount() > 0) bRowsSelected = TRUE; } .......
}
|
|
![]() |
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 |