On 2009-07-17 at 14:40:19 [+0200], Rene Gollent <anevilyak@xxxxxxxxx> wrote: > On Fri, Jul 17, 2009 at 7:27 AM, Axel Dörfler<axeld@xxxxxxxxxxxxxxxx> > wrote: > > Sure, but isn't that just view->Frame() + parent->Bounds().LeftTop() > > (ie. its scroll offset)? > > As far as I can see, no: > > Child Frame: BRect(l:41.0, t:0.0, r:939.0, b:31214.0) Child Bounds: > BRect(l:0.0, t:0.0, r:898.0, b:31214.0) Parent Bounds: BRect(l:0.0, > t:844.0, r:560.0, b:1195.0) Yes, but this is the correct behaviour. To get the true view port, you would have to do something like this: BRect visibleRect = Frame(); visibleRect &= parent->Bounds(); ConvertFromParent(&visibleRect); You probably know this, but let me try to clarify the meanings in my terms, because hopefully it will make clear why I think it's the correct behavior: BView::Frame() = area of the view within the parent. This is never clipped to the parents bounds! (If it would be, you couldn't even have the setup you have now.) BView::Bounds() = always the same size of Frame(), but converted to the local view coordinates. Ie, ignorant of the view's offset inside the parent coordinate system. Additionally, the bounds rectangle is offset by the current scrolling offset. Both areas do not tell you if some part of the view is obscured because the parent is actually too small. To get the visible area (ie clipped to the parent visible area), you have to use the calculation above. It is actually very important that it works like this, or else you could never add views to another view when it isn't already large enough to hold the view, or else it would be clipped. I guess what you want is that at least Bounds() is always clipped to the visible portion, but that's just not how it works. Bounds() and Frame() are always of equal size, only with different offset. It is important that Bounds() is something local to the view, it should never be affected by the parent viewport. A lot of calculations in our current codebase rely on the fact that Bounds() always tells you the view's local size. Best regards, -Stephan