• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Expanding and collapsing windows
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Expanding and collapsing windows


  • Subject: Re: Expanding and collapsing windows
  • From: Tim Hewett <email@hidden>
  • Date: Wed, 18 Jun 2003 17:54:47 +0100

Jeff,

Thanks, that worked great.

Regards,

Tim.

On Wednesday, Jun 18, 2003, at 13:13 Europe/London, Jeff Harrell wrote:

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.

References: 
 >Re: Expanding and collapsing windows (From: Jeff Harrell <email@hidden>)

  • Prev by Date: Apple Scripting Core Suite Fails
  • Next by Date: Re: Getting notified when my cell is hidden in NSOutlineView
  • Previous by thread: Re: Expanding and collapsing windows
  • Next by thread: NSFileWrapper initWithPath: returns nil?
  • Index(es):
    • Date
    • Thread