Hide AceEditor on resize past a minimum height - ace-editor

I have Ace Editor in a draggable group and it looks like there is a min height applied to it.
Is there a way to set this min height or better yet is there a way to hide the ace editor when the height is less than the min height?

Related

AutoLayout contraints - cannot resize height

I'm struggling a bit with the auto layout constraints in a super simple test view.
For test I added a label, want it x number of pixels from left side, and 5 pixels from top, right, bottom.
When I do this and do an update frame, the view collapse to the min height, and when I insert the view into a tab, the main window collapses and I cannot resize the height.
I can understand why the view collapses to min height, but why does the main window collapse, and why can't I adjust the height.
Which is the missing / wrong constraints.
Thanks
Edit: Noticed I by mistake used a TextField instead of a Label which could have explained the fixed height, but even after changing to a label I see the same issue. If I instead set the height to fixed, so the constraints are left, top, right, height, then I can resize the window as expected, but obviously the label doesn't resize its height.
The label's content-hugging priorities are presumably greater than NSLayoutPriorityWindowSizeStayPut (500). That tells the auto layout system to prefer to resize the window rather than stretch the label beyond the size required by its contents.
Reduce that priority.

Resize multi-line text field

So I just returned to GUI programming after a long time on Mac OS X. I heard about this great feature called Auto Layout. For my project I want a very simple layout: a textfield dominating the window, with a couple buttons at the bottom. When I resize the window, I want the textfield to resize with it.
I thought that was simple task: constraints on the 4 edges and Height and Width >= what I have in Interface Builder:
If I set it like this, I can't resize the window vertically, only horizontally. If I drop either the Height or Width constraint, it will shrink to a tiny size in a corner.
How should I set my constraints so that the textfield resize with the window?
To resize text field with the window size you need to add constraints to all the four edges of the text field! As per your screen shot you haven't added any constraints to the right and bottom edge, instead you have added dimensions (or say height and width)!
And to avoid making text field terribly small you can add min-width and height to it.

Adjust width and placement of NSSegmentedControl with dynamic in toolbar

I've got a pretty dynamic UI that uses a NSSegmentedControl in the toolbar of its document window.
The NSSegmentedControl dynamically gets its elements assigned.
The number of elements can vary widely between 1 and maybe 15.
At the moment the toolbar will not adjust for the number of elements in the NSSegmentedControl, i.e. after setting the number of segments via setSegmentCount: all segments that exceed the original width of the NSSegmentedControl (at the time the window was created) are clipped:
What would be the best way to tell the NSToolbar to recalculate the width of all its elements, i.e. the width of the NSSegmentedControl and the placements of all elements right to it?
The clipping is caused by NSToolbarItem's current value for -maxSize. Try adjusting its width with - setMaxSize: after you add segments to the NSSegmentedControl or directly set the maximal width in Interface Builder.
There is more info on this topic at https://developer.apple.com/library/mac/documentation/cocoa/Conceptual/Toolbars/Tasks/SettingTBItemSize.html

calculating minimum size needed to contain dialog

I want to compute the minimum size both vertical and horizontal that will contain a dialog.
I used GetClientRect to determine the width and height. Then for the width when a vertical scroll bar is needed I added GetSystemMetrics (SM_CXVSCROLL) + GetSystemMetrics (SM_CXSIZEFRAME) but I seem to come up a few pixels short.
What GetSysMetrics do I need to take into account for both the horizontal and vertical dimensions with and without scroll bars?
You need to account for window borders and other non-client area space. The easiest way to do this is use AdjustWindowRect() or AdjustWindowRectEx(). However, you will still need to handle the scroll bars yourself:
From the documentation:
The AdjustWindowRectEx function does not take the WS_VSCROLL or WS_HSCROLL styles into account. To account for the scroll bars, call the GetSystemMetrics function with SM_CXVSCROLL or SM_CYHSCROLL.
So, the steps are:
GetClientRect() to get your minimum size client area.
AdjustWindowRectEx() to convert the client size to window size based on your window styles.
If needed, apply additional adjustments to account for scroll bars (GetSystemMetrics() with SM_CXVSCROLL and/or SM_CYHSCROLL).

RDLC VS2010 Adjust the height of a text-box corresponding to the font-size

When I design a RDLC-Report and change the FontSize of a text-box to a smaller value, the height of the text-box is not adjusted automatically. If I try then to adjust the height manually, it's very difficult to find the right height.
Is there a simple possibility to adjust the height corresponding to the font size (in the designer)?
Pay attention to the grid spacing, Report + Report Properties, General tab, Grid spacing. The default setting is 0.125 inch, 4 points. With the "Snap to Grid" check box turned on, only font sizes that are a multiple of 4 are easy. If you try, say, a font of 10 points (not a multiple of 4) then you'll have a hard time sizing the text box.

Resources