• 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: utility window hides parent window?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: utility window hides parent window?


  • Subject: Re: utility window hides parent window?
  • From: Daryn <email@hidden>
  • Date: Tue, 20 May 2003 22:36:36 -0500

On Sunday, May 18, 2003, at 11:31 PM, Daryn wrote:
If a utility window (floating panel with hide on deactivate) is attached a normal window, then the normal window also hides on deactivation. Is this intended behavior? Is there a way to work around it?

Either I'm grossly misunderstanding something, or there is a bug lurking in the attached window interactions. Surely someone else would have stumbled upon this bug and there would be something in the archives?

Would someone please tell me there's an easier way to prevent an attached child utility window from causing the parent window to hide too? This window controller code just seems so wrong:

- (void)windowDidLoad {
id window = [self window];
[window useOptimizedDrawing:YES];
[window addChildWindow:docInputPanel ordered:NSWindowBelow];

// stops orderOut: on the parent from causing it to hide
// sigh, must kludge up a solution to hide the utility panel
[docInputPanel setHidesOnDeactivate:NO];

id center = [NSNotificationCenter defaultCenter];
[center addObserver:self
selector:@selector(showInputPanel:)
name:NSWindowDidBecomeMainNotification
object:window];
[center addObserver:self
selector:@selector(hideInputPanel:)
name:NSWindowDidResignMainNotification
object:window];
}

- (void)showInputPanel:(id)sender {
NSPoint windowOrigin = [[self window] frame].origin;
if (NSEqualPoints(savedInputPanelFrame.origin,NSZeroPoint)) { // FIXME
// inital positioning below main window
windowOrigin.y -= 1;
[docInputPanel setFrameTopLeftPoint:windowOrigin];
} else {
// restore size & offset from main window
savedInputPanelFrame.origin.x += windowOrigin.x;
savedInputPanelFrame.origin.y += windowOrigin.y;
[docInputPanel setFrame:savedInputPanelFrame display:NO];
}
}

-(void)hideInputPanel:(id)sender {
NSPoint windowOrigin = [[self window] frame].origin;
savedInputPanelFrame = [docInputPanel frame];
// use origin to store delta from main window in case it's moved while not frontmost
savedInputPanelFrame.origin.x -= windowOrigin.x;
savedInputPanelFrame.origin.y -= windowOrigin.y;
// setting to zero size is poor man's hide because orderOut: on panel still hides the parent window!
NSRect newFrame = savedInputPanelFrame;
newFrame.size = NSZeroSize;
[docInputPanel setFrame:newFrame display:NO];
}


Daryn
_______________________________________________
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: 
 >utility window hides parent window? (From: Daryn <email@hidden>)

  • Prev by Date: AS in Cocoa prob (LONG)
  • Next by Date: Re: Future Objective-C changes
  • Previous by thread: utility window hides parent window?
  • Next by thread: NIB file
  • Index(es):
    • Date
    • Thread