How do I wait for HandMorph>>openInHand to complete?

Ned Konz ned at bike-nomad.com
Mon Aug 23 13:42:37 UTC 2004


On Monday 23 August 2004 1:07 am, Trygve Reenskaug wrote:
> The conclusion is that there is indeed a single input process. But the
> openInHand mechanism can only be understood by considering the stack. There
> is no way I can wait until morph has been positioned, because the
> positioning only starts after I have returned.

What positioning are you waiting for? For the user to drop the Morph?

If so, you need only notice the first

 noteNewOwner: 

and see that the owner isn't a Hand.

That is, the states are:

* initialized (set a property in or just after #initialize if you want)
* in the hand (you should get a noteNewOwner: with the Hand)
* dropped somewhere else (you should get a noteNewOwner: with the new owner)

> 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

If you're trying for a modal action, you can either make your morph stateful 
and notice when it's been transferred from the Hand to something else (this 
is what I do with Connectors), or you can do what is done elsewhere in 
Morphic (like in the menus, for instance) to force modal behavior. That is to 
loop doing doOneCycle , i.e. not returning to the main UI loop until you're 
done. Try the following in a Workspace and see if it's what you want:

m := Morph new.
ActiveHand attachMorph: m.
[ m owner isHandMorph ] whileTrue: [ World doOneCycle ].
m color: Color red.

Sorry if I misunderstood what you were doing earlier.
-- 
Ned Konz
http://bike-nomad.com




More information about the Squeak-dev mailing list