• 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
Implementing behavior for "make" appleevent in Cocoa App.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Implementing behavior for "make" appleevent in Cocoa App.


  • Subject: Implementing behavior for "make" appleevent in Cocoa App.
  • From: "Neal A. Crocker" <email@hidden>
  • Date: Sun, 2 Sep 2001 01:33:47 -0700

Ok, I'm stumped... I'm considering how to implement behavior for the "make" or "create" appleevent in my Cocoa app. for creation of windows. (The app. will be a Cocoa based script shell for making Applescript applications that provides some UI capabilities to its embedded script). I've read the developer documentation on implementing scripting in Cocoa Apps. forwards, backwards, sideways and in various non-linear sequences (a little humor to defuse my frustration...) My first thought was that I could do it by adding a method to the NSApplication class (directly, using categories, a topic about which I will have to educate myself, or by subclassing) and setting up my app.'s .scriptSuite file to indicate that this new method handles the event. It seemed, however, that, what with Cocoa's rather extensive support for implementing scripting, the NSApplication object might already have such a method. I just can't figure out what it is... I can't find seem to find it in the documentation. I know that the Sketch application supports the create appleevent for allowing the application object to create document objects. I thought, perhaps, I could figure out how this is done from the example Sketch project, but no such luck. I figure there are several possibilites for how the create script command is supported. As I understand it, if the decription of an object in an app.'s .scriptSuite file fails to specify a method to handle the create event and the object inherits from NSObject (as is the case for the the application/NSApplication object in Sketch), an NSCreateCommand object is created when a create event is sent to the application object. If no other handling options exist, and NSCreateCommand implements performDefualtImplementation:, this method is invoked to handle the create event. So, does NSCreateCommand implement this method? If so, what does this method do? Also, where is it documented. Before the hypothetical performDefualtImplementation: method of NSCreateCommand is invoked, an attempt is made to locate a method to handle the NSCreatedCommand using something called key-value coding. Is this, in fact, how the create event is handled by the application object in Sketch? I've looked over the documentation on key-value coding to implement script support and, while I think I understand how how to properly name accessor methods to take advantage of it, I can't quitel figure how to name event handling methods to take advantage of it. Consequently, if, among the myriad methods defined for NSApplication, there exists a method which is identified by key-value coding as the method to handle create events, I wouldn't be able to spot it. So, if any one can point this method out, or, better yet, explain how to use key-value coding to identify a method as handling a appleevent, i'd be obliged. Also (or perhaps alternatively), if any one can explain to me how the Sketch application implements support for the create event (and can point me to the place in the source code where this is done), i'd be obliged.

Thanks,
Neal


  • Prev by Date: Writing a file type
  • Next by Date: Linking seperate nibs
  • Previous by thread: Re: Writing a file type
  • Next by thread: Linking seperate nibs
  • Index(es):
    • Date
    • Thread