From 8ceca690644745c4631c922087df3a1b74b76c63 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 25 Mar 2021 14:53:29 +0100 Subject: [PATCH] Always handle wxDP_ALLOWNONE ourselves in best size computation DTM_GETIDEALSIZE doesn't seem to account for it, so we need to do it ourselves even when using it. Closes #19120. --- src/msw/datetimectrl.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/msw/datetimectrl.cpp b/src/msw/datetimectrl.cpp index aaf8b80dc3..ee90f3a476 100644 --- a/src/msw/datetimectrl.cpp +++ b/src/msw/datetimectrl.cpp @@ -200,12 +200,15 @@ wxSize wxDateTimePickerCtrl::DoGetBestSize() const // Account for the drop-down arrow or spin arrows. size.x += wxSystemSettings::GetMetric(wxSYS_HSCROLL_ARROW_X, m_parent); - - // We need to account for the checkbox, if we have one. - if ( MSWAllowsNone() ) - size.x += 3 * GetCharWidth(); } + // We need to account for the checkbox, if we have one -- DTM_GETIDEALSIZE + // doesn't take it into account (actually, it somehow returns _smaller_ + // size when using DTS_SHOWNONE than when not using it, which doesn't make + // any sense at all). + if ( MSWAllowsNone() ) + size.x += 3 * GetCharWidth(); + int scrollY = wxSystemSettings::GetMetric(wxSYS_HSCROLL_ARROW_Y, m_parent); size.y = wxMax(size.y, scrollY);