PDA

View Full Version : Autosizing NSToolbarItems...




guitarmaster18
Feb 6, 2008, 04:50 PM
So, here's the situation. I have a NSToolbar, set up through the normal programmatic method. One item I have is set up through an NSView. The NSView contains a text field. How would I set autosizing rules for the text field?


Thank You!



kainjow
Feb 6, 2008, 08:12 PM
I guess it depends on how you want it to behave when resized, but I'd say to have its width adjust so that when the NSView expands the textfield expands along with it.

guitarmaster18
Feb 7, 2008, 05:26 AM
I guess it depends on how you want it to behave when resized, but I'd say to have its width adjust so that when the NSView expands the textfield expands along with it.

Well, when resized, I want the text field to contract and expand in the toolbar based on the size of the window. Do you know if that is possible?

Thanks!

kainjow
Feb 7, 2008, 08:45 AM
Well, when resized, I want the text field to contract and expand in the toolbar based on the size of the window. Do you know if that is possible?

Have you tried playing with the view's autoresizing mask (in IB) and seeing if it works already? Safari does this with the "address and search" item, so it's possible.

guitarmaster18
Feb 7, 2008, 02:49 PM
Have you tried playing with the view's autoresizing mask (in IB) and seeing if it works already? Safari does this with the "address and search" item, so it's possible.

Yeah, I've tried the traditional method (IB) many times. It doesn't seem to make any difference in the way the Text Field is resized in the toolbar.

Thank you,
guitarmaster18

kainjow
Feb 7, 2008, 02:58 PM
Well you'll probably have to set the view's frame manually when the window resizes. Even then it might not work.