Re: best way to refuse events?
Re: best way to refuse events?
- Subject: Re: best way to refuse events?
- From: "Timothy J. Wood" <email@hidden>
- Date: Fri, 16 Aug 2002 21:43:44 -0700
On Friday, August 16, 2002, at 07:17 PM, Matt Neuburg wrote:
Because I don't want to. I want to do what I said I want to do - when
I get
to the end of the process I want to throw away all pending events.
Basically I'm simply looking for the Cocoa equivalent of FlushEvents().
What is it? Thx - m.
NSDate *distantPast = [NSDate distantPast];
NSEvent *event;
while ((event = [NSSApp nextEventMatchingMask:NSAnyEventMask
untilDate:distantPast
inMode:NSDefaultRunLoopMode
dequeue:YES])) {
// do nothing with the event
}
Note that you might need to do something with some of the events. In
particular, you probably want do to:
NSEventType type;
type = [event type];
if (type == NSAppKitDefined || type == NSSystemDefined)
[NSApp sendEvent: event];
(or alternatively you could probably pass 'NSAnyEventMask &
~(NSAppKitDefined|NSSystemDefined)' as the event mask... take your
pick).
-tim
_______________________________________________
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.