[squeak-dev] A suggestion: allowing ctrl+drag in morphs

Stéphane Rollandin lecteur at zogotounga.net
Thu May 10 13:48:33 UTC 2018


Currently, it is not straightforward to define a ctrl+drag behavior for 
a morph when preference cmdGesturesEnabled is true (the case by 
default), because mouseDown when the control key is pressed opens a menu.

I did implement this for muO though.

In 6.0, it is very easy to do; we just need to add a line in the 
following method:

-----------------------

PasteUpMorph>>tryInvokeMetaMenu: anEvent

	| innerMost target |
	Preferences cmdGesturesEnabled ifFalse: [^ self].
	Preferences eToyFriendly ifTrue: [^ self].
	
	innerMost := (self morphsAt: anEvent position unlocked: true) first.

	innerMost honorsCtrlMetaMenu ifFalse: [^ self].  "<=== here"
	
	"Traverse the owner chain if some morph does not want to show its meta 
menu."
	target := innerMost.
	[target isNil or: [target wantsMetaMenu]] whileFalse: [target := target 
owner].
	target ifNil: [^ self].
	
	target invokeMetaMenu: anEvent.
	anEvent ignore.

------------------------

... with Morph>>#honorsCtrlMetaMenu returning true (so the current 
behavior does not change), overriden to false by any morph wanting to 
implement a ctrl+drag behavior.


Stef


More information about the Squeak-dev mailing list