<html>
<body>
<font size=3>Ploblem resolved!<br>
The problem was that I want to do things after
<i>Morph>>openInHand</i> has completed placing a new <i>morph
</i>on a canvas. I have received some interesting pointers, but the short
answer is that it cannot be done.<br><br>
I believe I understand what is happening. Open an inspector on
<i>ActiveHand </i>and select 'submorphs'. It is an empty Array. Keep the
inspector open while you run this code in a Workspace:<br>
<i> morph := Morph new. " create "<br>
morph openInHand. " place "<br>
Transcript show: ActiveHand submorphs.<br>
</i><x-tab> </x-tab><br>
The <i>morph </i>is attched to the <i>ActiveHand</i>; you can see that
its submorphs now includes it. The stack is actually 37 deep just after
the <i>openInHand</i>: <br><br>
<i>1: (3840) UndefinedObject/DoIt {#(a Morph(3795))}<br>
2: (2724) Compiler/evaluate:in:to:notifying:ifFail:<br>
3: (709) TextMorphEditor/evaluateSelection<br>
...<br>
25: (2920) HandMorph/sendFocusEvent:to:clear:<br>
26: (2920) HandMorph/sendEvent:focus:clear:<br>
27: (2920) HandMorph/sendKeyboardEvent:<br>
28: (2920) HandMorph/handleEvent:<br>
29: (2920) HandMorph/processEvents<br>
30: (3742) WorldState/doOneCycleNowFor:<br>
31: (3258) Array/do:<br>
32: (3742) WorldState/handsDo:<br>
33: (3742) WorldState/doOneCycleNowFor:<br>
34: (3742) WorldState/doOneCycleFor:<br>
35: (905) PasteUpMorph/doOneCycle<br>
36: (2445) Project class/spawnNewProcess<br>
37: (283) BlockContext/newProcess<br><br>
</i>Activations return after the <i>Transcript </i>statement until
<i>ActiveHand </i>gets control again (<i>WorldState>>processEvents
</i>?). <i>ActiveHand </i>with its attached <i>morph </i>is visible on
the screen and follows the cursor until the user presses the red button.
<i>ActiveHand </i>returns the <i>morph </i>to its real owner, removing it
from its <i>submorphs</i>. You can see this if you put this trace in
<br>
<i>Morph>>privateOwner:<br>
Transcript show:
aMorph.<br>
...<br><br>
</i>The conclusion is that there is indeed a single input process. But
the <i>openInHand </i>mechanism can only be understood by considering the
stack. There is no way I can wait until <i>morph </i>has been positioned,
because the positioning only starts after I have returned.<br><br>
This very cool software leaves me cold. Since I do not want to do other
things before the positioning completes, I replace it with a simple and
transparent mechanism a la Rectangle>>fromUser<br><br>
Cheers<br>
--Trygve <br><br>
<br><br>
<br>
Earlier mail:<br>
<blockquote type=cite class=cite cite>Karl, Ned,<br>
Many thanks for your suggestions. The following executed in a workspace
demonstrates the problem:<br><br>
<i>symbol := Morph
new.
" create "<br>
symbol
openInHand.
" place "<br>
(ActiveWorld submorphs includes: symbol) ifFalse: [self
error]. " Use. "<br><br>
</i>This test fails. But the last statement does not fail if I select and
<i>doIt </i>after having placed the new morph.<br><br>
The problem is clearly non-trivial. <br><br>
I have tried waiting after the openInHand:<br>
<i>ActiveWorld
doOneCycle.
" try to wait - 1. "<br>
ActiveWorld
doOneCycleNow.
" try to wait - 2. "<br>
ActiveWorld runLocalStepMethods.
" try to wait - 3. "<br>
</i>No help there.<br><br>
I have tried<br>
<i>symbol := Morph
new.
" create "<br>
symbol
openInHand.
" place "<br>
WorldState addDeferredUIMessage: <br>
<x-tab> </x-tab>[(ActiveWorld
submorphs includes: symbol) " use "<br>
ifFalse: [self error] ]<br>
</i>No change.<br><br>
I'm running Squeak3.6-5429-full. There is no <i>addedMorph:</i> method in
the whole system. (It is a feature of 3.7)<br><br>
<i>Morph>>intoWorld:</i> runs when owner is set, but the morph is
not yet positioned. So it runs before <i>openInHand </i>returns. A halt
shows that it is in the same thread as the triggering menu command and
<i>openInHand</i>. But the positioning is independent of this thread and
takes place while the halt debugger is open.<br><br>
Amazing.<br>
--Trygve</blockquote><br>
<x-sigsep><p></x-sigsep>
-- <br><br>
Trygve Reenskaug mailto: trygver <at>
ifi.uio.no<br>
Morgedalsvn. 5A
<a href="http://heim.ifi.uio.no/~trygver" eudora="autourl">http://heim.ifi.uio.no/~trygver</a><br>
N-0378 Oslo
Tel: (+47) 22 49 57 27<br>
Norway<br>
</font></body>
<br>
</html>