Re: performSelectorOnMainThread & NSEventTrackingRunLoopMode
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