[Q] Making a button immune to mouse clicks
Alan.Kay at squeakland.org
Sun Apr 14 17:10:40 UTC 2002
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 ...
At 4:31 PM +0200 4/14/02, Andreas Raab wrote:
>> 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.
>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.
>(which is kinda pointless but hey).
> - Andreas
More information about the Squeak-dev