From 07e13c51d15dc564ad1c2bcf57a66068d2a7a22a Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Wed, 30 Aug 2023 09:12:59 +0200 Subject: [PATCH] UNIT_BINDER: allows more room to show values (especially inches need room) Fixes #15539 https://gitlab.com/kicad/code/kicad/-/issues/15539 --- common/widgets/unit_binder.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common/widgets/unit_binder.cpp b/common/widgets/unit_binder.cpp index 732e667a4f..a3f5a44f15 100644 --- a/common/widgets/unit_binder.cpp +++ b/common/widgets/unit_binder.cpp @@ -66,8 +66,11 @@ UNIT_BINDER::UNIT_BINDER( UNITS_PROVIDER* aUnitsProvider, wxWindow* aEventSource if( textEntry ) { wxClientDC dc( m_valueCtrl ); + + // Gives enough room to display a value in inches i )n textEntry + // 4 digits + '.' + 10 digits + 2 chars (units) look enough. wxSize minSize = m_valueCtrl->GetMinSize(); - int minWidth = dc.GetTextExtent( wxT( "XXX.XXXXXXX" ) ).GetWidth(); + int minWidth = dc.GetTextExtent( wxT( "XXXX.XXXXXXXXXXUU" ) ).GetWidth(); if( minSize.GetWidth() < minWidth ) m_valueCtrl->SetMinSize( wxSize( minWidth, minSize.GetHeight() ) );