Page 1 of 1

OnAutoSizeColumns improvement

Posted: Sat Sep 02, 2017 7:12 am
by Edgar5
In file:
at or near line #1600 the old Explorerplusplus::OnAutoSizeColumns () logic ignored the possibility that the header text could be wider than the widest item in the column. This sizes the columns based on the widest of either the header or the widest item.

Code: Select all

void Explorerplusplus::OnAutoSizeColumns(void) {
   // re-spelled; made sizing wide enough for the maximum of header or items width
	size_t nColumns = m_pActiveShellBrowser->QueryNumActiveColumns();
   // nColumns is usually larger than the real number of columns displayed

   for (UINT column = 0; column < nColumns; column++) {
      ListView_SetColumnWidth(m_hActiveListView, column, LVSCW_AUTOSIZE_USEHEADER);
      int headerWidth = ListView_GetColumnWidth(m_hActiveListView, column);
      ListView_SetColumnWidth(m_hActiveListView, column, LVSCW_AUTOSIZE);
      int itemsWidth = ListView_GetColumnWidth(m_hActiveListView, column);
      if ((headerWidth == 0) && (itemsWidth == 0)) {
      else {
         ListView_SetColumnWidth(m_hActiveListView, column, max(headerWidth, itemsWidth));