• 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: Cocoa/Java - NSNotification not received.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa/Java - NSNotification not received.


  • Subject: Re: Cocoa/Java - NSNotification not received.
  • From: Rams <email@hidden>
  • Date: Fri, 7 Mar 2003 22:03:07 -0500

Ahhh, thank you Glen!

Total newbie mistake. I misunderstood the layout of the API docs. I didn't realize that the notification names were symbols. Swapping NSWindow.WindowDidMiniaturizeNotification for "WindowDidMiniaturizeNotification" does the trick. I guess I'm just used to javadocs where things are spelled out under headers like "Field Summary". Something about the heading "Notifications" made me think of it as a description, rather than class data. Had they been listed under constants, or something similar, their nature would have been more obvious to me... I will continue on now as any male shamed by having to stop and ask for directions :-)

On Friday, March 7, 2003, at 12:12 PM, email@hidden wrote:

Rams wrote:
|I am trying to receive notifications from a window without setting my
|object as the window's delegate. My code looks something like this...
|
| ...
|
| public void awakeFromNib() {
|
| // Waking code ending with...
| NSNotificationCenter.defaultCenter().addObserver(this,
| didMiniSelector,
| "WindowDidMiniaturizeNotification",
| null);
| }
|
| ...
|
|The problem is, I get no notifications. Does anyone have any insight?

I'd guess that you've got the name of the notification wrong. In vanilla Cocoa, notification names *always* start with "NS". While the documentation for the Cocoa-Java NSWindow class documents a WindowDidMiniaturizeNotification, it is documented as a *symbol*, not as a string literal. Where did you find documentation of the name as a string literal?

|I'm looking at
|http://developer.apple.com/techpubs/macosx/Cocoa/TasksAndConcepts/
|ProgrammingTopics/Notifications/Tasks/Threading.html and wondering if
|this is my problem.

Getting the notification name wrong seems a more likely explanation.

Glen Fisher


--

They call this a DeMoCrAcy?
_______________________________________________
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: 
 >Re: Cocoa/Java - NSNotification not received. (From: email@hidden)

  • Prev by Date: directory size
  • Next by Date: Re: directory size
  • Previous by thread: Re: Cocoa/Java - NSNotification not received.
  • Next by thread: NSData from object
  • Index(es):
    • Date
    • Thread