Fix the initial wxTextCtrl size in wxGTK
We need to explicitly call SetInitialSize() after setting the value of the control (if it's not empty), as the first call, done from inside of PostCreation(), doesn't take the initial control contents into account and so doesn't allocate the height correctly for multiline text controls containing more than 2 lines of text, for example. Closes https://github.com/wxWidgets/wxWidgets/pull/1891
This commit is contained in:
@@ -817,7 +817,14 @@ bool wxTextCtrl::Create( wxWindow *parent,
|
||||
if (!value.empty())
|
||||
{
|
||||
ChangeValue(value);
|
||||
InvalidateBestSize();
|
||||
|
||||
// The call to SetInitialSize() from inside PostCreation() didn't take
|
||||
// the value into account because it hadn't been set yet when it was
|
||||
// called (and setting it earlier wouldn't have been correct neither,
|
||||
// as the appropriate size depends on the presence of the borders,
|
||||
// which are configured in PostCreation()), so recompute the initial
|
||||
// size again now that we have set it.
|
||||
SetInitialSize(size);
|
||||
}
|
||||
|
||||
if (style & wxTE_PASSWORD)
|
||||
|
Reference in New Issue
Block a user