• 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
AppleEvents in Foundation tool (not working)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AppleEvents in Foundation tool (not working)


  • Subject: AppleEvents in Foundation tool (not working)
  • From: Allan Odgaard <email@hidden>
  • Date: Sun, 7 Nov 2004 14:17:32 +0100

How can I receive apple events in a Foundation tool?

If I take a notify on NSAppleEventManagerWillProcessFirstEventNotification it is never sent, and if I setup a handler using setEventHandler:andSelector:forEventClass:andEventID: the handler is never called.

If I call NSApplicationMain() then the above does work, but I get this error (four times):
Could not connect the action buttonPressed: to target of class NSApplication


I have no nib in my application (so I do not know why it wants to connect stuff).

A slightly related question, if I do a local event loop like this:
do {
isRunning = [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]];
} while(isRunning && !endRunLoop);


It seems my event handlers are not called during this event loop.

How can I do a local event loop and still have my event handlers called?


Basically what I want to do is to have a function called, and this function should not return before a certain apple event has been received.


My approach to this was to make it an ObjectiveC method, and have instance methods which would receive the apple event and set a boolean plus break the inner run-loop started in the method.

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


  • Follow-Ups:
    • Re: AppleEvents in Foundation tool (not working)
      • From: Finlay Dobbie <email@hidden>
    • Re: AppleEvents in Foundation tool (not working)
      • From: Allan Odgaard <email@hidden>
  • Prev by Date: Re: Resizing subviews within NSSplitView programmatically
  • Next by Date: Re: NSTableView, undo, bindings
  • Previous by thread: Window resize indicator
  • Next by thread: Re: AppleEvents in Foundation tool (not working)
  • Index(es):
    • Date
    • Thread