• 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: [Q] How do I Create an NSEvent Using Runtime Functions?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Q] How do I Create an NSEvent Using Runtime Functions?


  • Subject: Re: [Q] How do I Create an NSEvent Using Runtime Functions?
  • From: Maurice Volaski <email@hidden>
  • Date: Sun, 18 May 2003 14:22:55 -0400

on 5/18/03 13:50, Clark S. Cox III at email@hidden wrote:

> On Friday, May 16, 2003, at 22:46 US/Eastern, Maurice Volaski wrote:
>
>> on 5/16/03 13:36, Clark S. Cox III at email@hidden wrote:
>>
>>> On Friday, May 16, 2003, at 13:04 US/Eastern, Maurice Volaski wrote:
>>>
>>>> I would like to create an NSEvent object in a plain C program by
>>>> using
>>>> objc_msgSend to send the class method keyEventWithType, but I am
>>>> getting
>>>> back "selector not recognized".
>>>

>> but that's irrelevant because I enumerated the methods
>> and there is simply no create method
>
> Here is the output that I get from class-dump (which clearly shows that
> those methods do exist):

Just not where we think..It turns out there is more than one NSEvent object.
There is the "ordinary" NSEvent class object, which contains the instance
methods for NSEvent and a second "metaclass" version of the NSEvent class
object, which contains the class methods for it.

I was doing this...
NSEvent * theOrdinaryNSEventClassObject = objc_getClass("NSEvent");
theOrdinaryNSEventClassObject has the list of instance methods.

When I should have been doing this...
NSEvent * theNSEventMetaClass = objc_getMetaClass("NSEvent");
theNSEventMetaClass has the list of class methods.

The metaclass is poorly documented in Apple's Objective C book. It isn't
mentioned until near the end of the book, and the chapter on mechanisms and
methods doesn't even mention it let alone explain it.

--
Maurice Volaski, Flux Software email@hidden
http://www.fluxsoft.com/ ftp://ftp.fluxsoft.com
_______________________________________________
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: [Q] How do I Create an NSEvent Using Runtime Functions? (From: "Clark S. Cox III" <email@hidden>)

  • Prev by Date: Re: remove shadows on drawers?
  • Next by Date: [BUG] NSSelectorFromString Sometimes Lies
  • Previous by thread: Re: [Q] How do I Create an NSEvent Using Runtime Functions?
  • Next by thread: NSString <--> MacRoman Pascal String
  • Index(es):
    • Date
    • Thread