[Q] Making a button immune to mouse clicks

Ned Konz ned at bike-nomad.com
Sun Apr 14 18:52:22 UTC 2002


On Sunday 14 April 2002 11:22 am, Martin Drautzburg wrote:

> I believe, if I want to be able to drag I cannot have the button
> respond to a single click because a drag always starts with a
> click. So I'd have to use doubleClick to expand/collapse. Right ?

No. You can separately receive click and startDrag events. You get a 
click before you get a doubleClick event. Try this in a Workspace:

m _ Morph new.
m on: #click send: #value to: [ m color: Color red ].
m on: #startDrag send: #value to: [ m color: Color orange. ActiveHand 
grabMorph: m ].
m on: #doubleClick send: #value to: [ m color: Color green ].
m openInHand.

> I don't want to use the halo for dragging.

That's understandable.

> Some things I don't understand yet:
>
> do submorphs always appear *above* its owning morph ?

Depends on how you implement fullDrawOn: . You could re-implement it 
and go the other way; the default version in Morph draws the parent 
first.

> If an area is covered by a morph and a sumborph which one will
> receive the mouse events ?

Depends. There is mouseDownPriority that can be used to tweak this.

-- 
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE




More information about the Squeak-dev mailing list