Re: When do documents position windows?
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.