Re: [Q] How do I Create an NSEvent Using Runtime Functions?
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.