Strategies for fitting an NSWindow to its content?
Strategies for fitting an NSWindow to its content?
- Subject: Strategies for fitting an NSWindow to its content?
- From: Andrew Thompson <email@hidden>
- Date: Tue, 7 Oct 2003 00:25:05 -0400
Hi all,
A puzzle with window resizing.
Usually Cocoa employs an outside-in model. ie, one sets the frame of
one's NSWindow, and the views within it are resized according to their
Autosize settings.
However, what if I want to go the other way and have an NSWindow grow
and shrink as children of its content view change size?
The deal is I have a custom NSTextfield, which is one of several child
views of the content view of an NSWindow.
I manipulate this NSTextField, and it uses -[sizeToFit] to alter its
own size to grow or shrink to show its content.
However, if it gets bigger, it will be clipped by its containing
NSWindow.
Is there any way for an NSWindow to consider its content view's
children and realize that one has been resized such that its
frame/bounds lie outside the visible portion of the NSWindow?
To complicate things a little further, sometimes I remove the content
view in question from its parent window and put it elsewhere. It might
resize whilst not in the window, which means when I put it back in the
NSWindow, I might need to resize the window to be large enough to show
the new content.
I'm really just looking for ideas here. I'd like this to happen
automatically... I feel like there should be some way for an NSWindow
custom subclass to monitor what's being resized within its content view
and make sure its an appropriate size for everything to be visible.
AndyT (lordpixel - the cat who walks through walls)
A little bigger on the inside
(see you later space cowboy ...)
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.