You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The goal is to programmatically display a form (a bunch of controls) inside a window, and automatically resize the window to a "sensible" size that is never larger than the screen.
However when opening a form window (FormWindow), the window has a size that does not match the size of the controls in the form and needs to be manually resized by the user.
Expected behaviour
The desired behaviour of the window (FormWindow) is that the window expands to a size that is large enough to include the form controls (minimum size necessary to display all controls), unless that would make the window larger than the screen. In this case, the window should be limited by the screen size, and the form controls will be clipped (inside a scroll view).
The three sections are constrained to be on top of each other, in that order, filling the entire window. The relevant part for the purpose of this issue is the stack.
The stack is a NSStackView inside a NSScrollView. The NSStackView holds the form controls. The desired behavior is that the scroll view will grow to adjust to the minimum size necessary to accommodate the stack with no clipping, unless this will make the whole window larger than the screen, i.e. the top (or bottom) of the window is far off the screen and it can not be reached with the mouse.
If this were to happen, the NSScrollView should instead clip the stack view, so that the window is as large as the screen but it does not grow beyond it, and the user can scroll to visit the entire stack.
Why it doesn't work: the scroll size is always the minimum one. I need to manually resize the window after it's displayed.
Set the scroll size to be the stack size
scroll.height == stack.height
Why it doesn't work: the window is always as large as needed to display the form. This works as long as the stack plus the rest of the window is smaller than the screen. However it will make the window larger than the screen.
Modify the scroll view intrinsicContentSize
I subclassed NSStackView to return an intrinsic content size which is equal to the size of the documentView. However, the intrinsic size property is accessed before performing the layout, so the intrinsic content size of the subview at that moment is (-1,-1).
The text was updated successfully, but these errors were encountered:
Problem
The goal is to programmatically display a form (a bunch of controls) inside a window, and automatically resize the window to a "sensible" size that is never larger than the screen.
However when opening a form window (
FormWindow
), the window has a size that does not match the size of the controls in the form and needs to be manually resized by the user.Expected behaviour
The desired behaviour of the window (
FormWindow
) is that the window expands to a size that is large enough to include the form controls (minimum size necessary to display all controls), unless that would make the window larger than the screen. In this case, the window should be limited by the screen size, and the form controls will be clipped (inside a scroll view).How to reproduce
carthage bootstrap --platform osx
EasyDialogExample
schemaDetails
The window in
FormWindow
is composed of three sections:The three sections are constrained to be on top of each other, in that order, filling the entire window. The relevant part for the purpose of this issue is the stack.
The stack is a
NSStackView
inside aNSScrollView
. TheNSStackView
holds the form controls. The desired behavior is that the scroll view will grow to adjust to the minimum size necessary to accommodate the stack with no clipping, unless this will make the whole window larger than the screen, i.e. the top (or bottom) of the window is far off the screen and it can not be reached with the mouse.If this were to happen, the
NSScrollView
should instead clip the stack view, so that the window is as large as the screen but it does not grow beyond it, and the user can scroll to visit the entire stack.Attempted solution
Set the scroll size min and max
Why it doesn't work: the scroll size is always the minimum one. I need to manually resize the window after it's displayed.
Set the scroll size to be the stack size
Why it doesn't work: the window is always as large as needed to display the form. This works as long as the stack plus the rest of the window is smaller than the screen. However it will make the window larger than the screen.
Modify the scroll view
intrinsicContentSize
I subclassed
NSStackView
to return an intrinsic content size which is equal to the size of thedocumentView
. However, the intrinsic size property is accessed before performing the layout, so the intrinsic content size of the subview at that moment is(-1,-1)
.The text was updated successfully, but these errors were encountered: