mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-08-17 17:02:51 +08:00
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:
committed by
Vadim Zeitlin
parent
b0d50ffe91
commit
7a5aeaa159
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user