From b28b9d44c42f863d7c5a2c41918ee43bd1f4e388 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 27 Sep 2014 20:46:28 +0000 Subject: [PATCH] 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 --- samples/dataview/dataview.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/samples/dataview/dataview.cpp b/samples/dataview/dataview.cpp index 434274f085..d25e956005 100644 --- a/samples/dataview/dataview.cpp +++ b/samples/dataview/dataview.cpp @@ -578,7 +578,8 @@ void MyFrame::BuildDataViewCtrl(wxPanel* parent, unsigned int nPanel, unsigned l // column 2 of the view control: 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 = new wxDataViewColumn( "year", sr, 2, 60, wxALIGN_LEFT, 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( "lousy" ); wxDataViewChoiceRenderer *c = - new wxDataViewChoiceRenderer( choices, wxDATAVIEW_CELL_EDITABLE, wxALIGN_RIGHT ); + new wxDataViewChoiceRenderer( choices, wxDATAVIEW_CELL_EDITABLE, + wxALIGN_RIGHT | wxALIGN_CENTRE_VERTICAL); wxDataViewColumn *column3 = new wxDataViewColumn( "rating", c, 3, 100, wxALIGN_LEFT, wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_RESIZABLE );