Remove override of GetSelectedItemCount(); call DeleteItem() rather than SetItemCount() to reduce # of rows

svn path=/trunk/boinc/; revision=17006
This commit is contained in:
Charlie Fenton 2009-01-24 00:05:53 +00:00
parent 44571ef4bd
commit 2e90dfe915
4 changed files with 15 additions and 16 deletions

View File

@ -699,3 +699,13 @@ David 23 Jan 2009
sched/
sched_send.cpp
Charlie Jan 23 2009
- MGR: Remove override of GetSelectedItemCount() introduced yesterday;
instead, call DeleteItem() rather than SetItemCount() when number of
rows has been reduced, to allow virtual ListCtrl adjust its list of
selected rows (and thus keep its count in sync with reality.)
clientgui/
BOINCBaseView.cpp
BOINCListCtrl.cpp,.h

View File

@ -278,12 +278,15 @@ void CBOINCBaseView::OnListRender(wxTimerEvent& event) {
m_pListPane->SetItemCount(iDocCount);
m_bNeedSort = true;
} else {
for (iIndex = 0; iIndex < (iCacheCount - iDocCount); iIndex++) {
// We can't just call SetItemCount() here because we need to
// let the virtual ListCtrl adjust its list of selected rows
// to remove (deselect) any beyond the new last row
for (iIndex = (iCacheCount - 1); iIndex >= iDocCount; --iIndex) {
m_pListPane->DeleteItem(iIndex);
iReturnValue = RemoveCacheElement();
wxASSERT(!iReturnValue);
}
wxASSERT(GetDocCount() == GetCacheCount());
m_pListPane->SetItemCount(iDocCount);
m_pListPane->RefreshItems(0, iDocCount - 1);
m_bNeedSort = true;
}

View File

@ -409,19 +409,6 @@ void MyEvtHandler::OnPaint(wxPaintEvent & event)
}
}
// Work around a bug in generic list control which doesn't
// adjust count when a selected item is deleted
int CBOINCListCtrl::GetSelectedItemCount() {
int i = -1, n = 0;
while (1) {
i = GetNextSelected(i);
if (i < 0) break;
n++;
}
return n;
}
#endif

View File

@ -91,7 +91,6 @@ private:
void DrawProgressBars(void);
wxScrolledWindow* GetMainWin(void) { return (wxScrolledWindow*) m_mainWin; }
wxCoord GetHeaderHeight(void) { return m_headerHeight; }
int GetSelectedItemCount();
#endif
};