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: "Clark S. Cox III" <email@hidden>
- Date: Sun, 18 May 2003 13:50:37 -0400
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".
How are you getting the selector? If you're just passing in a C
By name using CFSTR,
CFSTR will return an NSString/CFString, not a selector. A selector is
a pointer to a C-string in a table maintained by the runtime.
You can call:
SEL NSSelectorFromString(NSString *aSelectorName);
or:
SEL sel_getUid(const char *str);
Any other way will not get you a working selector.
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):
[dev6-osx:~] ccox% class-dump -C NSEvent
/System/Library/Frameworks/AppKit.framework/
/*
* Generated by class-dump (version 2.1.5).
*
* class-dump is Copyright (C) 1997, 1999, 2000, 2001 by Steve
Nygard.
*/
/*
* File: /System/Library/Frameworks/AppKit.framework/
*/
@interface NSGraphicsContext(NSEventSourceCategory)
- (void *)contextID;
@end
@interface NSEvent:NSObject <NSCopying, NSCoding>
{
int _type;
struct _NSPoint _location;
unsigned int _modifierFlags;
int _WSTimestamp;
double _timestamp;
int _windowNumber;
NSWindow *_window;
NSGraphicsContext *_context;
union ? _data;
void *_eventRef;
}
+ mouseEventWithType:(int)fp12 location:(struct _NSPoint)fp16
modifierFlags:(unsigned int)fp24 timestamp:(double)fp40
windowNumber:(int)fp32 context:fp36 eventNumber:(int)fp40
clickCount:(int)fp44 pressure:(float)fp48;
+ keyEventWithType:(int)fp12 location:(struct _NSPoint)fp16
modifierFlags:(unsigned int)fp24 timestamp:(double)fp40
windowNumber:(int)fp32 context:fp36 characters:fp40
charactersIgnoringModifiers:fp44 isARepeat:(char)fp51 keyCode:(unsigned
short)fp54;
+ enterExitEventWithType:(int)fp12 location:(struct _NSPoint)fp16
modifierFlags:(unsigned int)fp24 timestamp:(double)fp40
windowNumber:(int)fp32 context:fp36 eventNumber:(int)fp40
trackingNumber:(int)fp44 userData:(void *)fp48;
+ otherEventWithType:(int)fp12 location:(struct _NSPoint)fp16
modifierFlags:(unsigned int)fp24 timestamp:(double)fp40
windowNumber:(int)fp32 context:fp36 subtype:(short)fp42 data1:(int)fp44
data2:(int)fp48;
+ (struct _NSPoint)mouseLocation;
+ _eventWithCGSEvent:(struct _CGSEventRecord)fp8;
+ (void)_resetDiscardMask;
+ (void)_discardEventsFromSubthread:fp12;
+ (void)_discardEventsWithMask:(unsigned int)fp12 eventTime:(unsigned
long long)fp16;
+ (void)startPeriodicEventsAfterDelay:(double)fp40
withPeriod:(double)fp48;
+ (void)_stopPeriodicEventsForSource:fp12;
+ (void)stopPeriodicEvents;
- (void)_fixCommandAlphaShifts;
- _initWithCGSEvent:(struct _CGSEventRecord)fp8 eventRef:(void *)fp120;
- (struct _CGSEventRecord)_cgsEventRecord;
- (struct _CGSEvent)_cgsevent;
- (int)type;
- (struct _NSPoint)locationInWindow;
- (unsigned int)modifierFlags;
- (double)timestamp;
- window;
- (int)windowNumber;
- context;
- (int)eventNumber;
- (int)clickCount;
- (float)pressure;
- (int)buttonNumber;
- (float)_eventRecordDelta:(int)fp12;
- (float)deltaY;
- (float)deltaX;
- (float)deltaZ;
- tabletEvent;
- characters;
- charactersIgnoringModifiers;
- (char)_isDeadkey;
- (void)_setEventRef:(void *)fp12;
- (void)_postFromSubthread:(struct __CFBoolean *)fp12;
- (void)_postAtStart:(char)fp12;
- (char)isARepeat;
- (unsigned short)keyCode;
- (int)trackingNumber;
- (void *)userData;
- (short)subtype;
- (int)data1;
- (int)data2;
- (void *)_eventRef;
- description;
- copyWithZone:(struct _NSZone *)fp12;
- copy;
- (char)isEqual:fp12;
- (void)dealloc;
- (void)encodeWithCoder:fp12;
- initWithCoder:fp12;
- (int)_nxeventTime;
- (unsigned long long)_cgsEventTime;
- _eventRelativeToWindow:fp12;
@end
@interface __NSEventDiscardInfo:NSObject
{
unsigned int mask;
unsigned long long time;
}
@end
[dev6-osx:~] ccox%
--
http://homepage.mac.com/clarkcox3/
email@hidden
Clark S. Cox, III
_______________________________________________
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.