Sensor vs. Hand (was: Re: Squeak-3.7: Title-Bar Buttons)

Andreas Raab andreas.raab at gmx.de
Mon Feb 23 11:14:52 UTC 2004


> So when you say:
> "NEVER, NEVER use Sensor. DO NOT EVER USE IT! Refer
> to the hand instead." is this is a short way of saying:
> " Never use sensor. Extend HandMorph with your own code instead. "?

No, it's a way of saying (and meaning ;) "NEVER, NEVER use Sensor if you
write code for Morphic". You need to get your information from the hand to
be a proper Morphic citizen.

> 1) IMO, it is not a good idea to extend basic library
> classes in simple applications. The surface area between
> the evolving Squeak releases and my own applications
> become very large and very hard to handle. It will #^@!
> things up.

Sure. What's your point?

[BTW, did I miss half of your message? You're jumping from 1) to 3) here...]

> 3) Aren't you overselling a bit when you suggest replacing
> Sensor with HandMorph in applications?

Not at all if you look at the subtlety of problems introduced (did you read
the thread leading up to this post?)

> Need really all of them be harmful to Morphic?

Most the messages dealing mouse and keyboard *are* harmful. What's even
worse is - you can't say for sure. That's why I'm saying "get your state
from the hand" and make HandMorph polymorphic enough with Sensor so people
will easily recognize that the same state is available.

> I have used Sensor
> when I need the current state of mouse and keyboard, and events
> when I need the state at a certain time. Following your advice,
> it looks as if I have to do a lot of low-level programming to
> maintain contact with the input devices.

If you want your app to work properly within Morphic, yes you will. But it's
an exception to use input devices directly. And it's also because of being
able to "easily use" input devices that I left Sensor working in the way it
does. But that's entirely unrelated to the fact that "Morphic applications"
should get their state from the hand unless they have reason not to. And
querying for the shift state or the cursor point is NOT a reason to screw
around with the way Morphic works.

> 4) Finally: After a couple of hours frustrating archeology
> into Squeak, I wonder if a good solution could be to say
>
>      CurrentHand lastEvent shiftPressed,
>(or controlKeyPressed or whatever)
>
> If this is what you meant, you could have saved me a lot of
> irritating work by saying so in the first place.

It is not a good solution. The expression is way to long for people to
remember and it exposes what should be hidden inside the hand - for a client
it is irrelevant how the hand determines what its shift state is and it may
or may not use the last event. A polymorphic response is really what should
be in the hand including the majority of interesting/desirable information
from Sensor.

Secondly, it needs to be "ActiveHand" - this is the hand in control of the
current world, it's dynamic and if you don't have a hand you know about
(such as from some event) ActiveHand is what you want to use.

Cheers,
  - Andreas




More information about the Squeak-dev mailing list