Making all a doc's windows come forward when one does
Making all a doc's windows come forward when one does
- Subject: Making all a doc's windows come forward when one does
- From: Derrick Bass <email@hidden>
- Date: Fri, 24 Feb 2006 00:54:04 -0600
I have an application in which each document can have multiple
windows associated with it. I'm trying to make all the windows
associated with a document come forward when the user brings one of
the document's windows forward. Currently I have the following code
in my NSDocument sublass, which is the delegate for the document's
windows:
-(void) windowDidBecomeMain:(NSNotification *) note {
int wnum = [[note object] windowNumber];
int prev = 0;
NSArray *windowControllers = [self windowControllers];
unsigned int count = [windowControllers count];
for (unsigned int i=0; i<count; ++i) {
NSWindow *window = [[windowControllers objectAtIndex:i] window];
if ([window isVisible] && [window windowNumber] != wnum) {
[window orderWindow:NSWindowBelow relativeTo:(prev == 0 ? wnum :
prev)];
prev = [window windowNumber];
}
}
}
This code works when I just click on windows that are already
onscreen. But if I create a new window for the document then the old
window for the document disappears! It's still there, somewhere: if I
bring another document (or application) forward and then bring the
original forward, the missing window reappears.
What's going on here? Is this the right approach? (I looked at the
setLevel: method, but that appears to be for very different purposes.)
One thing I noticed is that windowDidBecomeMain gets called before
the window actually becomes visible, even though [[note object]
isVisible] return YES.
Thanks for any help you can provide!
Derrick
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden