• 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
(no subject)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(no subject)


  • Subject: (no subject)
  • From: Bruce Veazie <email@hidden>
  • Date: Wed, 1 Jan 2003 19:45:04 -0500

Scot-

My solution is to setup 2 notifications:
("window" in the first notification would be your pref panel itself.)

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(windowWillClose:) name:NSWindowWillCloseNotification
object:window];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(colorPanelChanged:)
name:NSColorPanelColorDidChangeNotification object:nil];

My panel "manager" class has an instance variable NSColorPanel
*colorPanel. It's just a place to store the color panel id. When I get
the NSColorPanelColorDidChangeNotification (when the user has clicked a
color well and the color panel appears) I save a pointer to the color
panel.

- (void)colorPanelChanged:(NSNotification *)note
{
colorPanel = [ note object ];
}

When the preference panel itself is closed (i.e., the user is done with
it), my "windowWillClose" method is called and I just close the color
panel along with it.

- (void)windowWillClose:(NSNotification *)notification {
if( colorPanel ) [ colorPanel close ];
colorPanel = nil;
}

Hope this helps.

> I have a NSColorWell on a preference panel. If I cause the
> NSColorWell to
> display a NSColorPanel and then cause the preference panel to close,
> the
> NSColorPanel does not close, but remains visible.
>
> N the code that I have to close the reference panel, I'm issuing a:
>
> [_colorWell deactivate];
>
> I thought issuing a deactivate would cause the color panel to be
> dismissed,
> but it does not.
>
> What is the proper manner in which to ensure the color panel gets
> closed?
>
>
> Scot

Bruce J. Veazie
email@hidden
http://veazie.org
_______________________________________________
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.

  • Prev by Date: Re: Break into Debugger...
  • Next by Date: Re: How to receive dragging files into TableView
  • Previous by thread: Re: Cocoa code for publishing a calendar
  • Next by thread: (no subject)
  • Index(es):
    • Date
    • Thread