diff options
-rw-r--r-- | vcl/source/control/edit.cxx | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index e8798a295380..bb94ee3c8bc8 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -2894,7 +2894,9 @@ Size Edit::CalcMinimumSizeForText(const OUString &rString) const Size aSize; if (mnWidthInChars != -1) { - aSize = CalcSize(mnWidthInChars); + //CalcSize calls CalcWindowSize, but we will call that also in this + //function, so undo the first one with CalcOutputSize + aSize = CalcOutputSize(CalcSize(mnWidthInChars)); } else { @@ -2907,9 +2909,13 @@ Size Edit::CalcMinimumSizeForText(const OUString &rString) const aSize.Height() = GetTextHeight(); aSize.Width() = GetTextWidth(aString); aSize.Width() += ImplGetExtraOffset() * 2; + // do not create edit fields in which one cannot enter anything // a default minimum width should exist for at least 3 characters - Size aMinSize(CalcSize(3)); + + //CalcSize calls CalcWindowSize, but we will call that also in this + //function, so undo the first one with CalcOutputSize + Size aMinSize(CalcOutputSize(CalcSize(3))); if (aSize.Width() < aMinSize.Width()) aSize.Width() = aMinSize.Width(); } |