tags:

views:

124

answers:

1

It seems like the best approach is to use NSToolbar. However, it is not obvious to me how to make an NSTextField within an NSToolbar flexible in terms of width. Is this possible? The default behavior of the textfield is to remain a constant width, even if the toolbar is resized.

+2  A: 

Make sure you set maxSize and minSize correctly on the toolbar item, and then set the autoresize mask on the text field itself. You control the sizing of a view in a toolbar just as if it was in a window, either make sure its width is flexible in IB if you're creating it there, or specify NSViewWidthSizable if you're creating it in code.

Marc Charbonneau
In IB there are maximum and minimum width and height settigns. However, they are not saved -- they are always reverted to the actual width of the textfield.