Fix issue with text edit boxes being too narrow on wxWidgets 3.2.

This commit is contained in:
Jeff Young 2022-12-12 20:45:24 +00:00
parent 243727428a
commit 3144459939
1 changed files with 8 additions and 0 deletions

View File

@ -31,6 +31,7 @@
#include <confirm.h>
#include "widgets/unit_binder.h"
#include "wx/dcclient.h"
wxDEFINE_EVENT( DELAY_FOCUS, wxCommandEvent );
@ -65,6 +66,13 @@ UNIT_BINDER::UNIT_BINDER( UNITS_PROVIDER* aUnitsProvider, wxWindow* aEventSource
if( textEntry )
{
wxClientDC dc( m_valueCtrl );
wxSize minSize = m_valueCtrl->GetMinSize();
int minWidth = dc.GetTextExtent( wxT( "XXX.XXXXXXX" ) ).GetWidth();
if( minSize.GetWidth() < minWidth )
m_valueCtrl->SetMinSize( wxSize( minWidth, minSize.GetHeight() ) );
// Use ChangeValue() instead of SetValue() so we don't generate events.
if( m_negativeZero )
textEntry->ChangeValue( wxT( "-0" ) );