r28258 (adapting BScrollView to be usable in layout management) exposed a

problem in TextSearch. After the change, the scrollbar and child view layout
would be messed up there. The reason is that TextSearch calls
scrollview->ResizeToPreferred() prior to adding it to the window. In this
situation, the child views (scrollbars, target view) do not follow the parent
view. Before r28258, ResizeToPreferred() would not change the size of the
view (calling it in TextSearch is stupid anyways, since it is layouted later
in the code). I have thought about how to best fix this. I know 100% that there
is code out there that will mess with scrollbar layout. So it wouldn't be a
good option to refactor the layout out of BScrollView::DoLayout() and calling
that method from AttachedToWindow(), although that seems like the cleanest
option. Instead, I opted to simply reject resizing in ResizeToPreferred()
when the scroll view is not yet attached to a window. What do others think?


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28409 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2008-10-31 18:51:13 +00:00
parent fc7b01b188
commit 125ec81512

View File

@ -493,6 +493,8 @@ BScrollView::FrameResized(float width, float height)
void
BScrollView::ResizeToPreferred()
{
if (Window() == NULL)
return;
BView::ResizeToPreferred();
}