• How to manage layout of overlapping views

    From Joe Betz@21:1/5 to All on Sun Dec 19 01:57:11 2021
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Joe Betz@21:1/5 to Joe Betz on Sun Dec 19 02:34:01 2021
    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.






    On Sunday, December 19, 2021 at 10:57:12 AM UTC+1, Joe Betz wrote:
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)