On Mon, May 21, 2012 at 03:46:21PM -0700, Sean P. DeNigris wrote:
> I want to add a good comment to addDeferredUIMessage:. I know we use it
> whenever we're updating Morphic from a background thread, but I've read
> stuff saying to use it when Morphic is not in a "sane" state. 

In Squeak:

addDeferredUIMessage: valuableObject 
        "Arrange for valuableObject to be evaluated at a time when the user 
interface
        is in a coherent state."

> 
> When, if ever, would you call addDeferredUIMessage: from the UI thread?
> 
> I posted the following to the Squeak list 2 years ago....
> 
> I'm trying to add some documentation to addDeferredUIMessage:.  What's a
> good summary on this method? 
> 
> I collected the following snippets from the web... 
> 
> If you want to run something that accesses the Morphic UI, even though you
> are not running from somewhere that the UI is in a sane state, you should
> normally use addDeferredUIMessage:. Otherwise, you can put Morphic into
> extremely confused states.... 
> 
> Per Ned Konz @ http://wiki.squeak.org/squeak/528:
> Deferred UI messages are processed in the middle of the Morphic event loop,
> just after responding to events, and before doing other step methods and
> displaying the world. Look for implementors of #addDeferredUIMessage:, look
> at the one in WorldState, look for senders of #deferredUIMessages, and
> you'll see WorldState>>runStepMethodsIn: which empties the queue. And it's
> called from doOneCycleNowFor: which is the body of the main Morphic event
> loop. 
> 
> Per http://wiki.squeak.org/squeak/5689:
> If you want to run something that accesses the Morphic UI, even though you
> are not running from somewhere that the UI is in a sane state, you should
> normally use addDeferredUIMessage:. Otherwise, you can put Morphic into
> extremely confused states.... 
> 
> Per Wilhelm K Schwab @
> http://forum.world.st/Fwd-MouseOverHandler-td1300474.html#a1300474:
> provides a clean way to interact with the GUI from background threads 
> 
> Per http://www.visoracle.com/squeak/faq/containerless.html:
> As it is now, it's quite simple to put long-running computations in 
> background threads; you just don't let the background threads call methods 
> directly on Morphs. We have addDeferredUIMessage: to queue up action from 
> the background threads for later execution in the UI thread during the 
> next window cycle. 
> 
> Sean
> 
> --
> View this message in context: 
> http://forum.world.st/addDeferredUIMessage-Documentation-tp4631251.html
> Sent from the Pharo Smalltalk mailing list archive at Nabble.com.

Reply via email to