Re: NSText Field changes my window size
Re: NSText Field changes my window size
- Subject: Re: NSText Field changes my window size
- From: Kyle Sluder <email@hidden>
- Date: Sun, 18 Nov 2012 19:33:41 -0800
On Sun, Nov 18, 2012, at 05:26 PM, Todd Heberlein wrote:
> I have a Text Field (not static), that is bound to some text. It has two
> horizontal constraints, both "equals", one to the object on its left and
> the other to the object on its right.
>
> When I set the Text Field's Behavior to "Editable", it displays as I
> expect: if the text it is bound to is changed and is too long to fit in
> the text field, the text scrolls off to the side and is invisible (unless
> you select and move your cursor in the field to display the stuff on the
> right)
>
> However, if I set Behavior to "Selectable" or "None", then when the text
> is too long to fit in the text box, it resizes the text box which forces
> the window to resize.
>
> Can I get the "Editable" behavior (that is, don't automatically resize
> the window) but by having its behavior set to "Selectable"?
You should be able to achieve this by lowering the text field's content
compression resistance priority to less than
NSLayoutPriorityWindowSizeStayPut (that is, 500).
You might also need to make sure that your non-editable text field has
some truncation behavior specified and its "Truncates Last Visible Line"
property is set.
--Kyle Sluder
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden