• 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: When do documents position windows?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: When do documents position windows?


  • Subject: Re: When do documents position windows?
  • From: Marco Scheurer <email@hidden>
  • Date: Thu, 6 Jun 2002 20:50:15 +0200

On Thursday, June 6, 2002, at 07:27 pm, Donald Brown wrote:

I came up with a workaround that's a bit of a kludge, I created a subclass
of NSWindow called NoCascadeWindow, with one function:

- (NSPoint)cascadeTopLeftFromPoint:(NSPoint)topLeftPoint
{
NSString* sStr = [self frameAutosaveName];
if ((sStr!=nil)&&([sStr length]>0))
return topLeftPoint;
else
return [super cascadeTopLeftFromPoint:topLeftPoint];
}

Opening a new window over an existing window won't position properly, but
opening multiple new windows will.

OK, I'll use it too. Here is a small improvment:

- (NSPoint) cascadeTopLeftFromPoint:(NSPoint) topLeftPoint
{
if (isNilOrEmpty ([NSApp orderedDocuments]) && !isNilOrEmpty ([self frameAutosaveName])) {
return topLeftPoint;
}
else {
return [super cascadeTopLeftFromPoint:topLeftPoint];
}
}

where isNilOrEmpty() is macro we have to replace the patterns: (array == nil) || ([array count] == 0) and (string == nil) || ([string isEqualToString:@""]) among others.

Note that because of Unicode [string isEqualToString:@""] is how you should test for empty strings (unlikely in that case, but still...)

Marco Scheurer
Sen:te, Lausanne, Switzerland http://www.sente.ch
_______________________________________________
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.

  • Follow-Ups:
    • Categories, Protocols, Delegates and ToolTips
      • From: Paul Cezanne <email@hidden>
References: 
 >Re: When do documents position windows? (From: Donald Brown <email@hidden>)

  • Prev by Date: Re: Why does the memory increase?
  • Next by Date: Re: [ANN] AccessorGenerator
  • Previous by thread: Re: When do documents position windows?
  • Next by thread: Categories, Protocols, Delegates and ToolTips
  • Index(es):
    • Date
    • Thread