[Q] doubleclickable and dragable morph: how?

tblanchard at mac.com tblanchard at mac.com
Fri May 2 02:18:01 UTC 2003


While we are on the subject - there's something not quite kosher about 
either the double click handling or ColorPickerMorph's event handling.  
I'm trying to make a morph that, when double clicked, lets me pick a 
new color for it.

subclass Morph (call it Swatch).

add these methods:

mouseDown: anEvent
	anEvent hand waitForClicksOrDrag: self event: anEvent.

handlesMouseDown: e
	^true

doubleClick: anEvent
	self changeColor

Try double clicking on it - the color picker often never appears, or 
when it does it opens and closes immediately.  I think its pulling a 
mouse event it shouldn't get but I'm not having any luck tracking it 
down.

On Thursday, May 1, 2003, at 01:41  PM, Ingo Hohmann wrote:

> Hi Andreas,
>
> I can only second what Hernan already said, use of #handlesMouseDown 
> is described in at least some of the tutorials.
>
> Now, if I use your scheme how do I later catch these events? Do I 
> still add #MouseDown ?
>
> Andreas Raab wrote:
>> Try:
>> 	myMorph on: #startDrag send: #onDrag to: myMorph.
>> 	myMorph on: #doubleClick send: #onDoubleClick to: myMorph.
>> Note that #handlesMouseDown: should be never ever overridden unless 
>> you know
>> EXACTLY what you are doing. You're starting to infere with some deep 
>> down
>> notions of Morphic and likely to break more than you (think you) fix.
>> Cheers,
>>   - Andreas
>
> Kind regards,
>
> Ingo
>
>
>



More information about the Squeak-dev mailing list