• 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: performSelectorOnMainThread & NSEventTrackingRunLoopMode
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: performSelectorOnMainThread & NSEventTrackingRunLoopMode


  • Subject: Re: performSelectorOnMainThread & NSEventTrackingRunLoopMode
  • From: Chris Suter <email@hidden>
  • Date: Wed, 21 Mar 2007 12:47:28 +1100


On 21/03/2007, at 11:29 AM, Douglas Davidson wrote:


On Mar 20, 2007, at 5:21 PM, Chris Suter wrote:

I know what the problem is, this e-mail is to see if anyone has a workaround as I'm still trying to figure out the best solution. I'm also posting to warn others who might be doing something similar.

For a workaround, you might subclass NSTextView and override mouseDown: to set a flag and call super; then you could use performSelectorOnMainThread with a method that would check that flag, and perform its action immediately only if it is clear, otherwise it could put it in a queue. Your mouseDown: override could then check that queue after the super call returns, and do any actions in it, then clear the flag.

Yes, I was thinking along those lines although I don't like having to sub-class NSTextView and all the others I might need to do.


What I think I'm going to do is sub-class NSApplication, override sendEvent and do the same as you describe above. This relies on performSelectorOnMainThread: not going via sendEvent which it doesn't at the moment, and hopefully won't in the future (I haven't checked on Leopard yet).

The code is here for those that are interested:

http://www.cocoadev.com/index.pl?SafelyPerformSelectorOnMainThread

Thanks.

- Chris

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: 
 >performSelectorOnMainThread & NSEventTrackingRunLoopMode (From: Chris Suter <email@hidden>)
 >Re: performSelectorOnMainThread & NSEventTrackingRunLoopMode (From: Douglas Davidson <email@hidden>)

  • Prev by Date: Re: How to detect main menu being opened
  • Next by Date: Re: Switching NSArrayControllers around
  • Previous by thread: Re: performSelectorOnMainThread & NSEventTrackingRunLoopMode
  • Next by thread: NSData dataWithBytes problem on Intel
  • Index(es):
    • Date
    • Thread