[Q] Making a button immune to mouse clicks

Alan Kay Alan.Kay at squeakland.org
Sun Apr 14 17:10:40 UTC 2002


Martin --

Also note that you can drag a button without invoking the mouse 
action by using its handles. Do command-click (alt-click on a PC) to 
get the handles. The black one lifts and moves the morph. The brown 
one drags the morph and preserves its depth.

Or you could make a border from an enclosing morph that is not 
sensitive to the mouse ...

Cheers,

Alan

------

Cheers,

Alan

At 4:31 PM +0200 4/14/02, Andreas Raab wrote:
>Martin,
>
>>  I want the Button to be event-wise a lot bigger than the visible
>>  Button. I want a large Rectangle with a small Button in it. In the
>>  remaining space in the Rectangle I want to put other things, but I
>>  want to be able to drag the whole thing around with the button.
>
>I am completely confused by your description. You say you want "the
>Button to be event-wise a lot bigger than the visible Button" which to
>me means you want the button to be a button (e.g., clickable). But then
>you say you want to "drag the whole thing around". So do you want to
>make a button (e.g., an object that performs an action upon click) or
>not? Or is it just that you want to have a morph that _looks_ like one
>of the button classes (e.g., like SimpleButtonMorph)? In this case you
>can construct your own pretty easily, e.g., something like:
>
>m _ RectangleMorph new.
>m borderWidth: 1.
>m cornerStyle: #rounded.
>m color: (Color r: 0.4 g: 0.8 b: 0.6).
>m borderColor: m color darker.
>label _ StringMorph new contents: 'Flash'.
>m extent: label extent + m borderWidth + 6.
>m addMorphCentered: label.
>m openInWorld.
>
>will give you something that looks exactly like a SimpleButtonMorph.
>
>>  How can I possibly drag a button without invoking the mouse action?
>
>You don't. A button is an object that has an action to perform on a
>click. Unless of course ... you do something like:
>
>m := SimpleButtonMorph new.
>m on: #mouseDown send: #grabMorph: to: m.
>m openInWorld.
>
>(which is kinda pointless but hey).
>
>Cheers,
>   - Andreas


-- 



More information about the Squeak-dev mailing list