FROM : Glen Simmons
DATE : Tue Aug 29 23:03:32 2006
I'd like to create and send an event for Option-E. I tried this code,
using the same values the system-generated event has:
NSEvent* fakeEvent = [NSEvent keyEventWithType:NSKeyDown
location:NSZeroPoint
modifierFlags:0x80120
timestamp:0
windowNumber:[[NSApp
mainWindow] windowNumber]
context:nil
characters:@""
charactersIgnoringModifiers:@"e"
isARepeat:NO
keyCode:14];
[NSApp postEvent:fakeEvent atStart:NO];
This throws an exception: *** -[NSCFString characterAtIndex:]: Range
or index out of bounds
Why? What's wrong with this code? How can I send an event for Option-E?
Thanks,
Glen Simmons
DATE : Tue Aug 29 23:03:32 2006
I'd like to create and send an event for Option-E. I tried this code,
using the same values the system-generated event has:
NSEvent* fakeEvent = [NSEvent keyEventWithType:NSKeyDown
location:NSZeroPoint
modifierFlags:0x80120
timestamp:0
windowNumber:[[NSApp
mainWindow] windowNumber]
context:nil
characters:@""
charactersIgnoringModifiers:@"e"
isARepeat:NO
keyCode:14];
[NSApp postEvent:fakeEvent atStart:NO];
This throws an exception: *** -[NSCFString characterAtIndex:]: Range
or index out of bounds
Why? What's wrong with this code? How can I send an event for Option-E?
Thanks,
Glen Simmons
| Related mails | Author | Date |
|---|---|---|
| Glen Simmons | Aug 29, 23:03 | |
| Uli Kusterer | Aug 30, 19:40 | |
| Glen Simmons | Aug 30, 19:51 | |
| Aki Inoue | Aug 30, 23:09 |






Cocoa mail archive

