#14939: Using wxCOL_WIDTH_AUTOSIZE in wxDataViewColumn does not work under Cocoa
----------------------+---------------------------
Reporter: dconnet | Owner:
Type: defect | Status: confirmed
Priority: normal | Milestone: 3.1.5
Component: wxOSX | Version: stable-latest
Resolution: | Keywords:
Blocked By: | Blocking:
Patch: 1 |
----------------------+---------------------------
Changes (by vadz):
* status: new => confirmed
Comment:
Thanks again, I've finally tested this and it works for me, so I'm merging
it.
For the reference, here is the updated version of the patch allowing to
reproduce the problem:
{{{
#!diff
diff --git a/samples/dataview/dataview.cpp b/samples/dataview/dataview.cpp
index 98630dc39a..614716ff7e 100644
--- a/samples/dataview/dataview.cpp
+++ b/samples/dataview/dataview.cpp
@@ -775,7 +775,7 @@ void MyFrame::BuildDataViewCtrl(wxPanel* parent,
unsigned int nPanel, unsigned l
wxDataViewTextRenderer *tr =
new wxDataViewTextRenderer( "string",
wxDATAVIEW_CELL_INERT );
wxDataViewColumn *column0 =
- new wxDataViewColumn( "title", tr, 0, FromDIP(200),
wxALIGN_LEFT,
+ new wxDataViewColumn( "title", tr, 0,
wxCOL_WIDTH_AUTOSIZE, wxALIGN_LEFT,
wxDATAVIEW_COL_SORTABLE |
wxDATAVIEW_COL_RESIZABLE );
m_ctrl[Page_Music]->AppendColumn( column0 );
#if 0
@@ -788,7 +788,7 @@ void MyFrame::BuildDataViewCtrl(wxPanel* parent,
unsigned int nPanel, unsigned l
tr = new wxDataViewTextRenderer( "string",
wxDATAVIEW_CELL_EDITABLE );
wxDataViewColumn *column1 =
- new wxDataViewColumn( "artist", tr, 1, FromDIP(150),
wxALIGN_LEFT,
+ new wxDataViewColumn( "artist", tr, 1,
wxCOL_WIDTH_AUTOSIZE, wxALIGN_LEFT,
wxDATAVIEW_COL_SORTABLE |
wxDATAVIEW_COL_REORDERABLE |
wxDATAVIEW_COL_RESIZABLE );
column1->SetMinWidth(FromDIP(150)); // this column can't be
resized to be smaller
@@ -800,7 +800,7 @@ void MyFrame::BuildDataViewCtrl(wxPanel* parent,
unsigned int nPanel, unsigned l
new wxDataViewSpinRenderer( 0, 2010,
wxDATAVIEW_CELL_EDITABLE,
wxALIGN_RIGHT |
wxALIGN_CENTRE_VERTICAL);
wxDataViewColumn *column2 =
- new wxDataViewColumn( "year", sr, 2, FromDIP(60),
wxALIGN_LEFT,
+ new wxDataViewColumn( "year", sr, 2,
wxCOL_WIDTH_AUTOSIZE, wxALIGN_LEFT,
wxDATAVIEW_COL_SORTABLE |
wxDATAVIEW_COL_REORDERABLE );
m_ctrl[Page_Music]->AppendColumn( column2 );
@@ -814,19 +814,19 @@ void MyFrame::BuildDataViewCtrl(wxPanel* parent,
unsigned int nPanel, unsigned l
new wxDataViewChoiceRenderer( choices,
wxDATAVIEW_CELL_EDITABLE,
wxALIGN_RIGHT |
wxALIGN_CENTRE_VERTICAL);
wxDataViewColumn *column3 =
- new wxDataViewColumn( "rating", c, 3, FromDIP(100),
wxALIGN_LEFT,
+ new wxDataViewColumn( "rating", c, 3,
wxCOL_WIDTH_AUTOSIZE, wxALIGN_LEFT,
wxDATAVIEW_COL_REORDERABLE |
wxDATAVIEW_COL_RESIZABLE );
m_ctrl[Page_Music]->AppendColumn( column3 );
// column 4 of the view control:
- m_ctrl[Page_Music]->AppendProgressColumn( "popularity", 4,
wxDATAVIEW_CELL_INERT, FromDIP(80) );
+ m_ctrl[Page_Music]->AppendProgressColumn( "popularity", 4,
wxDATAVIEW_CELL_INERT, wxCOL_WIDTH_AUTOSIZE );
// column 5 of the view control:
MyCustomRenderer *cr = new
MyCustomRenderer(wxDATAVIEW_CELL_ACTIVATABLE);
wxDataViewColumn *column5 =
- new wxDataViewColumn( "custom", cr, 5,
wxCOL_WIDTH_DEFAULT, wxALIGN_LEFT,
+ new wxDataViewColumn( "custom", cr, 5,
wxCOL_WIDTH_AUTOSIZE, wxALIGN_LEFT,
wxDATAVIEW_COL_RESIZABLE );
column5->SetBitmap(wxArtProvider::GetBitmap(wxART_INFORMATION,
wxART_MENU));
m_ctrl[Page_Music]->AppendColumn( column5 );
}}}
It would, of course, still be great to have a unit test checking that this
works, but well...
--
Ticket URL: <
https://trac.wxwidgets.org/ticket/14939#comment:5>