Re: Window cascading
Re: Window cascading
- Subject: Re: Window cascading
- From: Richard Somers <email@hidden>
- Date: Tue, 08 May 2012 08:35:00 -0600
On May 8, 2012, at 3:01 AM, ecir hana wrote:
> I create a window like this:
>
> id window = [[[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 200,
> 200) styleMask:NSTitledWindowMask backing:NSBackingStoreBuffered
> defer:NO] autorelease];
> [window cascadeTopLeftFromPoint:NSMakePoint(20,20)];
>
> but it cascades just vertically - the next window is positioned to the very
> top left of my screen, the next one is just 20px lower (and 0px right), the
> next one is again 20px lower than the previous one but it wont move
> horizontally.
>
> Why's that? Do I have to remember the returned NSPoint and pass it to
> next cascadeTopLeftFromPoint:?
If I remember correctly you are using the document architecture. The documentation has this to say.
"If you use the Cocoa document architecture, you can use the setShouldCascadeWindows: method of NSWindowController to set whether the window, when it is displayed, should cascade in relation to other document windows (that is, have a slightly offset location so that the title bars of previously displayed windows are still visible). The default is true, so typically you have no additional work to perform.
If you are not using the document architecture, you can use the cascadeTopLeftFromPoint: method ofNSWindow to cascade windows yourself. The method returns a point shifted from the top-left corner of the window that can be passed to a subsequent invocation of cascadeTopLeftFromPoint: to position the next window so the title bars of both windows are fully visible."
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/WinPanel/Tasks/SizingPlacingWindows.html
Have you examined the EnhancedDataBurn sample code? It has two examples of where -[NSWindow cascadeTopLeftFromPoint:] is used.
http://developer.apple.com/library/mac/#samplecode/EnhancedDataBurn/Introduction/Intro.html
--Richard
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden