From 1aaf53ecac2cdc76688cd7e7d08b474efaa64196 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Sat, 20 Sep 2008 10:46:09 +0000 Subject: [PATCH] I accidentally removed some backwards compatible behavior. When there is no label, a TextControl maintains it's current width in ResizeToPreferred() if it is wide enough. Should fix #2751. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27646 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/TextControl.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/kits/interface/TextControl.cpp b/src/kits/interface/TextControl.cpp index 8bba4337ae..c88c009888 100644 --- a/src/kits/interface/TextControl.cpp +++ b/src/kits/interface/TextControl.cpp @@ -467,8 +467,15 @@ BTextControl::GetPreferredSize(float *_width, float *_height) _ValidateLayoutData(); - if (_width) - *_width = fLayoutData->min.width; + if (_width) { + float minWidth = fLayoutData->min.width; + if (Label() == NULL && !(Flags() & B_SUPPORTS_LAYOUT)) { + // Indeed, only if there is no label! BeOS backwards compatible + // behavior: + minWidth = max_c(minWidth, Bounds().Width()); + } + *_width = minWidth; + } if (_height) *_height = fLayoutData->min.height;