• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Access to events in tight loop?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Access to events in tight loop?


  • Subject: Re: Access to events in tight loop?
  • From: chaitanya pandit <email@hidden>
  • Date: Mon, 28 Jul 2008 12:17:04 -0400

What you can do is use the NSWindow's nextEventMatchingMask: method to determine the next event, here you can check for events that should discontinue your current processing.
So, say if u want to do some processing only while mouse down, and stop if there is a mouse up while you are doing it then u can do:


- (void)mouseDown:(NSEvent *)event
{
	while ([event type] != NSLeftMouseUp )
	{
		// do processing
		// get the new event
		event = [[self window] nextEventMatchingMask:NSLeftMouseUpMask];
	}
}

-Chaitanya
On 28-Jul-08, at 11:53 AM, Scott Squires wrote:

If I handle a mouse event and am processing it in a time consuming method which includes display, what's the cleanest way to peek at events
during this time (to get updated mouse info,etc ) or to allow the run loop to continue enough to make another pass?
Is there a clean way to allow the main thread to update?


I know I could create another thread for the routine but with issues of events, drawing and handling mutable arrays I thought I'd see if there was a simpler method I was overlooking.
Thanks.


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Access to events in tight loop? (From: Scott Squires <email@hidden>)

  • Prev by Date: Re: Access to events in tight loop?
  • Next by Date: Re: NSTableview Datasource and NSPopupbuttonCell
  • Previous by thread: Re: Access to events in tight loop?
  • Next by thread: Re: Access to events in tight loop?
  • Index(es):
    • Date
    • Thread