Re: Threads & NSTextView
Re: Threads & NSTextView
- Subject: Re: Threads & NSTextView
- From: Chris Hanson <email@hidden>
- Date: Sun, 24 Jul 2005 14:21:55 -0700
On Jul 24, 2005, at 4:56 AM, Laurent Michel wrote:
Ok. performSelectorOnMainThread: did the trick. So, now, for
educational purpose, what is the intended use of this pair of
methods then ? (lockFocusIfCanDraw, and unlockFocus) ?
The intended use is just as described in "Cocoa Thread Safety" at
<http://developer.apple.com/documentation/Cocoa/Conceptual/
Multithreading/articles/CocoaSafety.html>. You can use them to draw
into a view from another thread.
However, you can only *draw* into the view. Manipulating the view's
state -- or the state of objects the view depends on, for example an
NSTextView's textStorage -- is not the same as drawing NSBezierPaths.
I would recommend that, in general, the only thing that should invoke
any of the focus-locking methods on a view is the view itself. This
is because a view should know how to render itself, and if it
supports rendering outside the normal Cocoa update mechanism, it
should provide methods to do so that wrap things like focus-locking
and state synchronization.
-- Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden