Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to manage layout of overlapping views

28 views
Skip to first unread message

Joe Betz

unread,
Dec 19, 2021, 4:57:12 AM12/19/21
to
What's the correct layout to use if you want multiple subviews to take up 100% of the height and width of their parent?

I tried using FramingLayout on the parent view, then set all of the framing constraints both the model and menu views to the corresponding #fixedParentX, but it didn't work. The model view somehow ends up being way bigger than the shell, to the point that I can't even resize the window to see everything in it.

Is there a way to achieve what I want using the FramingLayout? And if not, what is the right way to handle this sort of relationship between views? Do I need to do something more complicated like the ScrollingDecorator?

The reason I need this is that the top-level shell view of my application has two subviews, one for the model and another for a menu. The menu is opened with a modifier key and overlayed on top of the model view by calling `zOrderTop` and then calls `zOrderBottom` when it closes. And that part works great, there's no flicker whatsoever. But the layout is borked.



model: anObject
super model: anObject.
self layoutManager: FramingLayout new.
menuView := self addSubView: Menu new.
menuView model: nil.
menuView arrangement
leftFraming: #fixedParentLeft;
rightFraming: #fixedParentRight;
topFraming: #fixedParentTop;
bottomFraming: #fixedParentBottom.
modelView := self addSubView: ModelView new.
modelView model: anObject.
modelView arrangement
leftFraming: #fixedParentLeft;
rightFraming: #fixedParentRight;
topFraming: #fixedParentTop;
bottomFraming: #fixedParentBottom

Joe Betz

unread,
Dec 19, 2021, 5:34:02 AM12/19/21
to
Okay, I inspected the FramingConstraints on the actual view and that revealed the problem. For whatever reason, the right and bottom offsets were non-zero. If I set them all to zero immediately after calling the framing method then it works correctly.

modelView arrangement
leftFraming: #fixedParentLeft; leftOffset: 0;
rightFraming: #fixedParentRight; rightOffset: 0;
topFraming: #fixedParentTop; topOffset: 0;
bottomFraming: #fixedParentBottom; bottomOffset: 0

Anyone know why this is necessary? `FramingConstraints>>initialize` initializes all the offsets to 0 so they must be getting mucked with dynamically.
0 new messages