From f80ff6f459f9412fcd51c8bca9d2f7a27cd15f3b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 22 Jun 2020 02:21:14 +0200 Subject: [PATCH] Tweak width of the date editor Don't make it larger than 150% than its normal width and also don't make it larger than its normal width at all if it's not going to be large enough to cover the entire cell anyhow -- this just looks strange, as the editor is both too wide and not wide enough. --- src/generic/grideditors.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/generic/grideditors.cpp b/src/generic/grideditors.cpp index 35e64bb03d..8c114143d9 100644 --- a/src/generic/grideditors.cpp +++ b/src/generic/grideditors.cpp @@ -1793,11 +1793,12 @@ void wxGridCellDateEditor::SetSize(const wxRect& r) wxRect rect(r.GetPosition(), bestSize); - // Allow edit picker to become a bit wider, if necessary, but no more than - // twice as wide as the best width, otherwise they just look ugly. - if ( r.GetWidth() > bestSize.GetWidth() ) + // Allow date picker to become a bit wider, if necessary, but not too wide, + // otherwise it just looks ugly. + if ( r.GetWidth() > bestSize.GetWidth() + && r.GetWidth() < 3*bestSize.GetWidth()/2 ) { - rect.SetWidth(wxMin(r.GetWidth(), 2*bestSize.GetWidth())); + rect.SetWidth(r.GetWidth()); } wxGridCellEditor::SetSize(rect.CenterIn(r, wxVERTICAL));