Re: Programmatically resizing an NSWindow based on window contents
Re: Programmatically resizing an NSWindow based on window contents
- Subject: Re: Programmatically resizing an NSWindow based on window contents
- From: Mike Abdullah <email@hidden>
- Date: Thu, 11 May 2006 17:47:50 +0100
On 11 May 2006, at 13:59PM, Greg Hurrell wrote:
El 11/05/2006, a las 14:08, Mike Abdullah escribió:
Yes, you want setFrame:display: or setFrame:display:animate
depending on what you need. There is not (as far as I am aware) a
way of making your window autosize based on the controls.
Thanks for chiming in.
I'd have thought a better approach would be to make your tableview
autosize with the window, and then only adjust the size of the
window yourself.
In 99% of cases I would agree, but this is a special case in which
the window is not resizable by the user, but depends on the size of
the table view. For an example that comes from Apple code, think of
the sheet that pops down when you edit rules in Mail.app: the user
can't resize the sheet but the sheet automatically grows and
shrinks and you add or remove rules from the rule list. The
Mail.app example uses a custom NSView class as far as I can tell,
but I'm using NSTableView so as not to have to re-invent the wheel...
Yes, I see what you want. At the moment, you intend to have things
happen in this sequence:
1. Set frame of tableview
2. Window updates to match tableview
What I am suggesting instead is:
1. Calculate the size of window you want to achieve the desired table
size
2. Set the frame of the window
3. This automatically sets your tableview to be the size you want
Cheers,
Greg
Mike. _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden