Re: Resize NSWindow Programatically
Re: Resize NSWindow Programatically
- Subject: Re: Resize NSWindow Programatically
- From: Dimitri Bouniol <email@hidden>
- Date: Mon, 4 Sep 2006 22:22:45 -0700
NSWindow has the following method: - (void)setFrame:(NSRect)
windowFrame display:(BOOL)displayViews animate:(BOOL)performAnimation
which might be appropriate for the disclosure.:
IBOutlet NSWindow *theWindow;
float nameInfoHeight;
float nameInfoWidth;
BOOL displayViews = YES; // Set if you want views to be redrawn.
-(IBAction)toggleNameInfo:(id)sender
{
NSRect newFrame;
if([nameView isHidden])
{
[nameView setHidden:NO];
newFrame.origin.x = [theWindow frame].origin.x;
newFrame.origin.y = [theWindow frame].origin.y - nameInfoHeight;
newFrame.size.width = [theWindow frame].size.width + nameInfoWidth;
newFrame.size.height = [theWindow frame].size.height + nameInfoHeight;
}
else
{
[nameView setHidden:YES];
newFrame.origin.x = [theWindow frame].origin.x;
newFrame.origin.y = [theWindow frame].origin.y + nameInfoHeight;
newFrame.size.width = [theWindow frame].size.width - nameInfoWidth;
newFrame.size.height = [theWindow frame].size.height - nameInfoHeight;
}
[theWindow setFrame:newFrame display:displayViews animate:YES];
}
Hope that works : )
--
The world's biggest Apple fan,
Dimitri Bouniol
email@hidden
_______________________________________________
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