MGR: Fix Select Columns dialog so it preserves column order

This commit is contained in:
Charlie Fenton 2015-10-14 04:47:26 -07:00
parent cd20b7627a
commit 80f5187ed8
1 changed files with 16 additions and 4 deletions

View File

@ -141,7 +141,7 @@ CDlgHiddenColumns::~CDlgHiddenColumns() {
void CDlgHiddenColumns::CreateCheckboxes() {
int i, j, stdCount, actualCount;
int i, stdCount, actualCount;
bool val;
CAdvancedFrame* pFrame = (CAdvancedFrame*)GetParent();
wxASSERT(wxDynamicCast(pFrame, CAdvancedFrame));
@ -195,8 +195,10 @@ void CDlgHiddenColumns::CreateCheckboxes() {
}
#endif
// Create checkboxes for shown columns in current column order
stdCount = pView->m_aStdColNameOrder->GetCount();
#ifdef wxHAS_LISTCTRL_COLUMN_ORDER
// Create checkboxes for shown columns in current column order
for (i=0; i<iShownColumnCount; ++i) {
wxString columnLabel = pView->m_aStdColNameOrder->Item(pView->m_iColumnIndexToColumnID[aOrder[i]]);
wxCheckBox* ckbox = new wxCheckBox(tabStaticBox, wxID_ANY, columnLabel);
@ -209,7 +211,7 @@ void CDlgHiddenColumns::CreateCheckboxes() {
// Create checkboxes for hidden columns
for (i=0; i<stdCount; ++i) {
bool found = false;
for (j = 0; j < iShownColumnCount; ++j) {
for (int j = 0; j < iShownColumnCount; ++j) {
if (pView->m_iColumnIndexToColumnID[aOrder[j]] == i) {
found = true;
break;
@ -223,13 +225,23 @@ void CDlgHiddenColumns::CreateCheckboxes() {
ckbox->SetValue(false);
checkbox_list->push_back(ckbox);
}
#else
for (i=0; i<stdCount; ++i) {
wxString columnLabel = pView->m_aStdColNameOrder->Item(i);
wxCheckBox* ckbox = new wxCheckBox(tabStaticBox, wxID_ANY, columnLabel);
checkboxSizer->Add(ckbox, 0, wxLEFT, 25);
val = false;
if (pView->m_iColumnIDToColumnIndex[i] >= 0) val = true;
ckbox->SetValue(val);
checkbox_list->push_back(ckbox);
}
#endif
m_checkbox_list.push_back(checkbox_list);
tabStaticBoxSizer->Add(checkboxSizer, 0, wxEXPAND, 1 );
m_scrolledSizer->Add(tabStaticBoxSizer, 0, wxEXPAND, 1 );
}
m_scrolledWindow->SetSizer( m_scrolledSizer );
m_scrolledWindow->Layout();
m_scrolledSizer->Fit( m_scrolledWindow );