Prevent wxTextEntryDialog from being resized in unexpected ways

Don't allow shrinking the dialog below its minimum size.

Also don't allow resizing single line entry dialogs vertically at all,
as the extra vertical space would be wasted anyhow and just makes the
dialog look bad.

Closes #25739.

Closes #26213.
This commit is contained in:
Blake-Madden
2026-02-20 22:00:55 +01:00
committed by Vadim Zeitlin
parent b0d50ffe91
commit 7a5aeaa159
+11 -1
View File
@@ -115,7 +115,17 @@ bool wxTextEntryDialog::Create(wxWindow *parent,
SetSizer( topsizer );
topsizer->Fit( this );
// Size returned by Fit() is the minimum size needed to fit the contents.
const wxSize minSize = topsizer->Fit( this );
// Prevent the dialog from being resized smaller than the minimum size.
SetMinSize(minSize);
// For single-line entry, also constrain max height to prevent vertical expansion
if ( !(style & wxTE_MULTILINE) )
{
SetMaxSize(wxSize(-1, minSize.GetHeight()));
}
if ( style & wxCENTRE )
Centre( wxBOTH );