Skip to content

Commit

Permalink
Merge pull request moneymanagerex#6918 from n-stein/fix(moneymanagere…
Browse files Browse the repository at this point in the history
…x#6847)

fix(moneymanagerex#6847): fix column width after move
  • Loading branch information
whalley authored Oct 2, 2024
2 parents eebce38 + 513c21b commit 727729c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/mmpanelbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ void mmListCtrl::OnHeaderMove(wxCommandEvent& WXUNUSED(event), int direction)
// wxLogDebug("m_real_columns: %s", wxJoin(m_real_columns, '|'));

// swap order of column data
Freeze();
std::swap(m_real_columns[m_ColumnHeaderNbr + direction], m_real_columns[m_ColumnHeaderNbr]);
std::swap(m_columns[m_ColumnHeaderNbr + direction], m_columns[m_ColumnHeaderNbr]);
std::swap(columnList[m_ColumnHeaderNbr + direction], columnList[m_ColumnHeaderNbr]);
Expand All @@ -202,16 +203,14 @@ void mmListCtrl::OnHeaderMove(wxCommandEvent& WXUNUSED(event), int direction)
// swap column headers & widths
wxListItem col1, col2;
col1.SetText(m_columns[m_ColumnHeaderNbr].HEADER);
col1.SetWidth(m_columns[m_ColumnHeaderNbr].WIDTH);
col1.SetAlign(static_cast<wxListColumnFormat>(m_columns[m_ColumnHeaderNbr].FORMAT));
col2.SetText(m_columns[m_ColumnHeaderNbr + direction].HEADER);
col2.SetWidth(m_columns[m_ColumnHeaderNbr + direction].WIDTH);
col2.SetAlign(static_cast<wxListColumnFormat>(m_columns[m_ColumnHeaderNbr + direction].FORMAT));
SetColumn(m_ColumnHeaderNbr, col1);
SetColumnWidth(m_ColumnHeaderNbr, m_columns[m_ColumnHeaderNbr].WIDTH);
SetColumn(m_ColumnHeaderNbr + direction, col2);

// refresh the list view
Refresh();
SetColumnWidth(m_ColumnHeaderNbr + direction, m_columns[m_ColumnHeaderNbr + direction].WIDTH);
Thaw();
}
}

Expand Down

0 comments on commit 727729c

Please sign in to comment.