#141 [wxTreeListCtrl] Incorrect width of hidden columns

Subversion_TRUNK
pending-fixed
5
2012-06-01
2012-04-27
T. Modes
No

The existing code for calculation of the column width does not consider hidden columns. The width is always the same, even when I hide all column beside the main column. The width remains always the same. I refer to the inner width and the scrollbars inside the wxTreeListCtrl.
The attached patch fixes this issue. It consists of 2 parts:

Part 1: a change to the function: wxTreeListColumnInfo& GetColumn (int column);

take the following code:
void wxTreeListCtrl::SetColumnShown(int column, bool shown)
{
wxASSERT_MSG (column != GetMainColumn(), _T("The main column may not be hidden") );
m_header_win->SetColumn (column, GetColumn(column).SetShown(GetMainColumn()==column? true: shown));
m_header_win->Refresh();
}

GetColumn(column) returns a reference to the column information of the control and therefore SetShown modifies it directly. Calling SetColumn now does not work correctly because the column information has already been updated before the call to SetColumn happens. So I changed GetColumn to return a copy (and not a reference), which can then modified and passed to SetColumn.

Part 2: Extended all calls to column changes to check for visibility for calculation of m_total_col_width.

Beside this the patch contains 2 changes to compile with wxWidgets 2.9 and fixes a little warning (on MSVC).

Discussion

  • Ronan Chartois

    Ronan Chartois - 2012-05-01
    • status: open --> open-accepted
     
  • Ronan Chartois

    Ronan Chartois - 2012-05-01

    Just added a 'SetColumnShown(1, false)' to the "Rebuild tree" command of the sample program, the total width is incorrect just like you reported ==> bug accepted
    No time right now to look at your patch but will try to get to it soon --thanks for submitting it!

     
  • T. Modes

    T. Modes - 2012-05-08

    Thanks, I updated my patch slightly.
    In the meantime I found out, that my included fix for the warning on windows did not work on MacOS. So I removed this fix and also fixed a small typo.

     
  • Ronan Chartois

    Ronan Chartois - 2012-06-01
    • status: open-accepted --> pending-fixed
     
  • Ronan Chartois

    Ronan Chartois - 2012-06-01

    fix uploaded to SVN (slightly different approach than in the proposed patch, but the patch helped a lot, so thanks again)
    Support for wxWidgets 2.9 coming as a separate check in

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks