Set Minimum resizable width of column in wxDataViewListCtrl Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
dermayank
Knows some wx things
Knows some wx things
Posts: 30
Joined: Fri Jan 22, 2021 8:56 am

Set Minimum resizable width of column in wxDataViewListCtrl

Post by dermayank »

Hi, I have a wxDataviewListCtrl with 7 columns. Now I have made 5 of these columns resizable using the flag wxDATAVIEW_COL_RESIZABLE. But I want that there should be a minimum threshold with beyond which the user can't shrink the column size.

Please help me, with how can I set this minimum threshold width.
User avatar
doublemax@work
Super wx Problem Solver
Super wx Problem Solver
Posts: 474
Joined: Wed Jul 29, 2020 6:06 pm
Location: NRW, Germany

Re: Set Minimum resizable width of column in wxDataViewListCtrl

Post by doublemax@work »

Try wxSettableHeaderColumn::SetMinWidth() (wxDataViewColumn derives from wxSettableHeaderColumn)
https://docs.wxwidgets.org/trunk/classw ... 3800a3dad3
dermayank
Knows some wx things
Knows some wx things
Posts: 30
Joined: Fri Jan 22, 2021 8:56 am

Re: Set Minimum resizable width of column in wxDataViewListCtrl

Post by dermayank »

Code: Select all

    wxDataViewListCtrl* table = new wxDataViewListCtrl(this, wxID_INDEX, wxDefaultPosition,
        wxDefaultSize);


   table->AppendToggleColumn("Select", wxDATAVIEW_CELL_ACTIVATABLE, FromDIP(50), wxALIGN_CENTRE, !wxDATAVIEW_COL_RESIZABLE);
   table->AppendTextColumn("Full Name", wxDATAVIEW_CELL_INERT, FromDIP(160), wxALIGN_CENTRE, wxDATAVIEW_COL_RESIZABLE);
   
   
This is the part of my code. Now I want to know how can I use wxSettableHeaderColumn::SetMinWidth() here?
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Set Minimum resizable width of column in wxDataViewListCtrl

Post by doublemax »

Code: Select all

wxDataViewColumn *col = table->AppendToggleColumn("Select", wxDATAVIEW_CELL_ACTIVATABLE, FromDIP(50), wxALIGN_CENTRE, !wxDATAVIEW_COL_RESIZABLE);
col->SetMinWidth(50);
Use the source, Luke!
Post Reply