• 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: C-Api Documentation - where?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C-Api Documentation - where?


  • Subject: Re: C-Api Documentation - where?
  • From: "Gerriet M. Denkmann" <email@hidden>
  • Date: Sun, 26 Feb 2012 12:16:28 +0700

On 25 Feb 2012, at 03:00, Conrad Shultz <email@hidden> wrote:

>
> On 2/24/12 8:31 AM, Gerriet M. Denkmann wrote:
>> This is a Cocoa app which uses NSRunloop etc. but which also wants to
>> know about kEventAppFrontSwitched. I just looked at
>> CarbonEventsCore.h and it says about GetEventParameter:
>> AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER and nothing about
>> deprecated or legacy.
>
> I don't know Carbon, but I'm guessing from the constant's name that you
> want to be informed when the active application has changed?
>
> If so, the following pure Cocoa works for me:
>
> - (void)frontAppChanged:(NSNotification *)note
> {
>    NSLog(@"Changed application: %@", [note userInfo]);
> }
>
> - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
> {
>    [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self
> selector:@selector(frontAppChanged:)
>                    name:NSWorkspaceDidActivateApplicationNotification
> object:nil];
> }

Thank you very much.

This works as well as watching Carbon events.
It requires less code.
It probably is less in danger of being deprecated any time soon.

So: it is a much better solution.

Kind regards,

Gerriet.



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Prev by Date: Re: Another Xcode Bug?
  • Next by Date: Re: Updating finally to Xcode 4
  • Previous by thread: Re: C-Api Documentation - where?
  • Next by thread: R: Xcode and Mapnik
  • Index(es):
    • Date
    • Thread