Re: Expanding and collapsing windows
Re: Expanding and collapsing windows
- Subject: Re: Expanding and collapsing windows
- From: Jeff Harrell <email@hidden>
- Date: Wed, 18 Jun 2003 07:13:47 -0500
It's easy. The NSWindow method you want to use is:
- (void)setFrame:(NSRect)frameRect display:(BOOL)displayFlag
animate:(BOOL)animationFlag
For example, this code snippet causes the window to move to the lower
left-hand corner of the screen and resize to 500 x 500 pixels, with
nice, smooth animation.
NSRect newframe = {{0, 0}, {500, 500}};
[[NSApp mainWindow] setFrame:newframe display:YES animate:YES];
If you just want to resize, you can do this:
NSRect frame = [[NSApp mainWindow] frame];
frame.size.width = 500;
frame.size.height = 500;
[[NSApp mainWindow] setFrame:newframe display:YES animate:YES];
That resizes the window without moving it. The point of origin is the
lower left corner. There's probably an easy way to transform that if
you want to, but in terms of the user experience the best thing might
be to design your window so its width never changes, and the animate
the height, System Preferences style.
On Wednesday, June 18, 2003, at 06:32 AM, Tim Hewett wrote:
Hello,
I want to be able to expand and collapse my app's main window
depending on the amount of info it is to display at a given time.
I've been looking for an example of how to do this, e.g. in a
"Save As..." dialogue there is a button to switch between a
simple, collapsed view and a more detailed expanded view -
the bottom of the window slides up and down to suit. So far
I've not found anything in the developer examples which does
this and the NSWindow and NVView documentation doesn't
seem to offer much help either. Is there an easy API for this or is
it fiddly? Any examples anywhere that anyone knows of?
Regards,
Tim.
_______________________________________________
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.
--
email@hidden
http://homepage.mac.com/jharrell
_______________________________________________
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.