[Q] Making a button immune to mouse clicks

Andreas Raab Andreas.Raab at gmx.de
Sun Apr 14 18:37:55 UTC 2002


> Sorry for that. Part of the problem is I don't know what I really
> want. 

Looks like it ;-)

> 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 ?

Wrong. Here's an example:

m := BorderedMorph new.
m on: #startDrag send: #grabMorph: to: m.
m on: #click send: #value to:[self inform:'you clicked'].
m openInWorld

When you drag the morph you drag it. When you click you click.

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

Yes.

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

The submorph unless
* the submorph is not interested (mouse down outside, mouse not handled,
locked etc)
* the #mouseDownPriority (see implementors of that method) of the outer
morph is larger than that of the submorph (note: this facility should be
used _very_ sparingly)

Cheers,
  - Andreas





More information about the Squeak-dev mailing list