Centre columns contents vertically in dataview sample.

If we specify the horizontal alignment, we also need to specify the vertical
alignment as otherwise the right-aligned columns would be also top-aligned,
looking out of kilter with the other columns which are centered by default.

Closes #16559.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77906 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2014-09-27 20:46:28 +00:00
parent 36a5983f64
commit b28b9d44c4

View File

@ -578,7 +578,8 @@ void MyFrame::BuildDataViewCtrl(wxPanel* parent, unsigned int nPanel, unsigned l
// column 2 of the view control: // column 2 of the view control:
wxDataViewSpinRenderer *sr = wxDataViewSpinRenderer *sr =
new wxDataViewSpinRenderer( 0, 2010, wxDATAVIEW_CELL_EDITABLE, wxALIGN_RIGHT ); new wxDataViewSpinRenderer( 0, 2010, wxDATAVIEW_CELL_EDITABLE,
wxALIGN_RIGHT | wxALIGN_CENTRE_VERTICAL);
wxDataViewColumn *column2 = wxDataViewColumn *column2 =
new wxDataViewColumn( "year", sr, 2, 60, wxALIGN_LEFT, new wxDataViewColumn( "year", sr, 2, 60, wxALIGN_LEFT,
wxDATAVIEW_COL_SORTABLE | wxDATAVIEW_COL_REORDERABLE ); wxDATAVIEW_COL_SORTABLE | wxDATAVIEW_COL_REORDERABLE );
@ -591,7 +592,8 @@ void MyFrame::BuildDataViewCtrl(wxPanel* parent, unsigned int nPanel, unsigned l
choices.Add( "bad" ); choices.Add( "bad" );
choices.Add( "lousy" ); choices.Add( "lousy" );
wxDataViewChoiceRenderer *c = wxDataViewChoiceRenderer *c =
new wxDataViewChoiceRenderer( choices, wxDATAVIEW_CELL_EDITABLE, wxALIGN_RIGHT ); new wxDataViewChoiceRenderer( choices, wxDATAVIEW_CELL_EDITABLE,
wxALIGN_RIGHT | wxALIGN_CENTRE_VERTICAL);
wxDataViewColumn *column3 = wxDataViewColumn *column3 =
new wxDataViewColumn( "rating", c, 3, 100, wxALIGN_LEFT, new wxDataViewColumn( "rating", c, 3, 100, wxALIGN_LEFT,
wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_RESIZABLE ); wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_RESIZABLE );