On 27 May 2012 01:58, Tudor Girba <[email protected]> wrote: > Hi, > > I am trying to build a complex morph and install it in another morph in a > background process such that it does not impact the rest of the user > interface. After a discussion with Igor, I got to the code below (similar to > what can be found in CodeAnnotationPane). > > However, it still does not seem to have the desired effect as the main ui > still appears to be blocked. Can anyone see any problem with the code? > > The code can be found in the latest version of Glamour. > > Cheers, > Doru > > > GLMWatcherWindow>>addContent: aBlockWhoseValueReturnsAMorph > | newMorph | > > "if we are still rendering some contents for another watcher, > we stop and replace with the current request" > process ifNotNil: [ process terminate ]. > process := nil. > > process := [ > WorldState addDeferredUIMessage: [ > newMorph := aBlockWhoseValueReturnsAMorph value. > self contentsMorph > removeAllMorphs; > addMorph: newMorph fullFrame: (LayoutFrame > fractions: (0@0 corner: 1@1)) > ] > ] newProcess. > process priority: Processor userBackgroundPriority. > process resume
Sure thing, because you still building your morph in UI thread (inside a block which you pass to addDeferredUIMessage. To make it clear, WorldState addDeferredUIMessage: can be rephrased as: WorldState evaluateThisBlockInUIProcess: So, moving newMorph := aBlockWhoseValueReturnsAMorph value. outside of this block will do the thing. > > -- > www.tudorgirba.com > > "Problem solving should be focused on describing > the problem in a way that makes the solution obvious." > > > > > -- Best regards, Igor Stasenko.
