Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

lopoz

macrumors regular
Original poster
May 10, 2005
134
9
Hello,

I'm new to Cocoa programming and just bought a book to learn some Cocoa (Cocoa Programming by The Pragmatic Programmers).

I'm trying to build a simple webbrowser (the first exercise in the book) and added a toolbar and a web view to my window. So far, so good.

Now I added an NSTextField to my toolbar and want it to automatically resize when I change the size of the main window.

So I set the maximum width to 2000:
23lctfq.png


And the autosize options to anchor left, top and right and to resize horizontally:
xlxu84.png


But when I click done, the maximum size of the NSTextField (which I set to 2000) goes back to the original size of the text field!

Any ideas? I hope I explained it clearly enough, please do ask if something is vague..

Thanks in advance!
 
Is this really that hard? TextFields not inside a toolbar work fine (i.e. they resize together with the window), but inside a toolbar they don't..
 
NSToolbars don't resize their views like a normal view does. I've seen code out there for replicating the behavior of how other apps like Safari and Mail resize text fields, so try searching around (cocoadev.com).
 
NSToolbars don't resize their views like a normal view does. I've seen code out there for replicating the behavior of how other apps like Safari and Mail resize text fields, so try searching around (cocoadev.com).
Thanks, I'll do that!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.