• 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: Notification when displays are detected?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Notification when displays are detected?


  • Subject: Re: Notification when displays are detected?
  • From: "Paul Sanders" <email@hidden>
  • Date: Tue, 29 Dec 2009 19:04:51 -0000

That looks OK to me.  I do:

NSNotificationCenter *dnc = [NSNotificationCenter defaultCenter];
[dnc addObserver: self selector: @selector (didChangeScreenParameters:)
    name: NSApplicationDidChangeScreenParametersNotification object: nil];

...

- (void) didChangeScreenParameters: (NSNotification *) notification
{
    ...
}

What object is 'self' in your scenario?  It needs to exist for the life of the app, obviously.

Paul Sanders.

----- Original Message -----
From: Jacob Schwartz
To: Paul Sanders
Cc: email@hidden
Sent: Tuesday, December 29, 2009 6:47 PM
Subject: Re: Notification when displays are detected?


I tried this one but it doesn't seem to be doing anything, so odds are I am adding the observer wrong. I am a little new at this, if that wasn't obvious haha.


// Second notification, when the screens change
[nc addObserver:self
selector:@selector(handleBackgroundChange:)
name:NSApplicationDidChangeScreenParametersNotification
object:nil];


The handleBackgroundChange is just supposed to print a message with NSLog.


-Jake Schwartz


On Dec 29, 2009, at 1:26 PM, Paul Sanders wrote:


  NSApplicationDidChangeScreenParametersNotification

  Returns a stale value for [NSScreen visibleFrame] after the dock
  moves from one screen to another (on Snow Leopard at least).
  Solution: wait a second or so, then ask again.

  This notification is also sent when the screen arrangement or
  dock is reconfigured.  I find this useful.

  Paul Sanders.

  ----- Original Message -----
  From: "Jacob Schwartz" <email@hidden>
  To: <email@hidden>
  Sent: Tuesday, December 29, 2009 6:15 PM
  Subject: Notification when displays are detected?


  Hey all,

  After some searching through the API, which apparently I am not
  good at, I figured asking was easier. Does anyone know of a
  notification that gets posted when another screen is
  added/detected. I figured it would be in NSWorkspace but I
  didn't see anything. Thanks.

  -Jake Schwartz
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Notification when displays are detected? (From: Jacob Schwartz <email@hidden>)
 >Re: Notification when displays are detected? (From: "Paul Sanders" <email@hidden>)
 >Re: Notification when displays are detected? (From: Jacob Schwartz <email@hidden>)

  • Prev by Date: Document-based application issue
  • Next by Date: Why does Core Data re-enter -beginUndoGrouping at Checkpoint?
  • Previous by thread: Re: Notification when displays are detected?
  • Next by thread: Re: Notification when displays are detected?
  • Index(es):
    • Date
    • Thread