• 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: Windows and Default Notification Center
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Windows and Default Notification Center


  • Subject: Re: Windows and Default Notification Center
  • From: Public Look <email@hidden>
  • Date: Fri, 23 Jul 2004 11:57:28 -0400

From
http://developer.apple.com/documentation/Cocoa/Reference/
ApplicationKit/ObjC_classic/Classes/NSWindow.html
Working with window status

 windowDidBecomeKey:

 windowDidBecomeMain:

 windowDidResignKey:

 windowDidResignMain:

However, you problem description suggests you want to use the responder
chain (which handles you issue already) instead of notifications.

On Jul 23, 2004, at 11:08 AM, Bruce Truax wrote:

> In my Cocoa Document based app my window controller has a method which
> handles messages which are sent to the default notification center.
> These
> messages are typically commands for actions sent by various menu
> dialogs.
> This method works great when there is one window open but when I have
> multiple windows all windows receive the command. This is because each
> window controller registers itself as a receiver when it is created.
> Obviously I have to manage who receives these messages as windows are
> moved
> to the front. I was looking for a window or window controller method
> which
> is called as a window is made the key window but I cannot find one.
>
>
> I register the with the default notification center as follows:
>
> //register to recieve the ACCommandReady notification sent by the
> dialogs
>
> [[NSNotificationCenter defaultCenter]
> addObserver:self
> selector:@selector(processCommand:)
> name:@"ACCommandReady"
> object:nil];
>
>
> I then use the following statements to send a command to the window
> controller:
>
> NSNotificationCenter *defaultCenter;
> defaultCenter = [NSNotificationCenter defaultCenter];
> [defaultCenter postNotificationName:@"ACCommandReady"
> object:command];
>
>
> The processCommand method in the window controller extracts the
> command from
> the NSNotification object and passes it on to the appropriate handler.
>
> What is the best way to handle these messages? I assume that somehow I
> should be sending the messages to the first responder but I do not see
> a way
> to pass a message with an argument to the first responder.
>
> Thanks.
>
> --
> ____________________________________________________________
> Bruce E. Truax email: email@hidden
> Optical Engineering Consultant
>
> Diffraction Limited Design LLC
> 388 Wedgewood Road voice: 860-276-0450
> Southington, CT 06489 fax: 860-620-9026
> http://www.dld-llc.com
> _____________________________________________________________
>
> Bruce
> _______________________________________________
> 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.
_______________________________________________
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:
    • Re: Windows and Default Notification Center
      • From: Bruce Truax <email@hidden>
References: 
 >Windows and Default Notification Center (From: Bruce Truax <email@hidden>)

  • Prev by Date: RE: Memory management, when mixing C and ObjC
  • Next by Date: Re: Memory management, when mixing C and ObjC
  • Previous by thread: Windows and Default Notification Center
  • Next by thread: Re: Windows and Default Notification Center
  • Index(es):
    • Date
    • Thread