Hi everybody,
I'm experiencing a strange problem: in my application I wait for keyDown events, using this code
I need to show a window after the pressure of some keys. I need also the program to stop while the user makes a choice in that window, so I call
To stop runModal I linked a button in the window to a method that runs:
The problem is that I receive a
error when trying to `stopModal`. Can someone explain me why and how to solve it?
Thanks in advance
I'm experiencing a strange problem: in my application I wait for keyDown events, using this code
Code:
machPort = CGEventTapCreate(kCGSessionEventTap,
kCGTailAppendEventTap,
kCGEventTapOptionDefault,
CGEventMaskBit(kCGEventKeyDown),
(CGEventTapCallBack) eventTapFunction,
self );
CFRunLoopSourceRef mKeyboardEventSrc = CFMachPortCreateRunLoopSource(kCFAllocatorDefault, machPort, 0);
CFRunLoopRef runLoop = CFRunLoopGetCurrent();
CFRunLoopAddSource(runLoop, mKeyboardEventSrc, kCFRunLoopDefaultMode);
Code:
[[NSApplication sharedApplication] runModalForWindow:myWindow];
Code:
[myWindow orderOut:self];
[[NSApplication sharedApplication] stopModal];
Code:
Assertion failure in -[NSEvent _initWithCGSEvent:eventRef:], /SourceCache/AppKit/AppKit-1038.35/AppKit.subproj/NSEvent.m:1260
Invalid parameter not satisfying: cgsEvent.type > 0 && cgsEvent.type <= kCGSLastEventType
Thanks in advance