[Cuis-dev] Drag event

ken.dickey at whidbey.com ken.dickey at whidbey.com
Sat Feb 8 07:25:25 PST 2025


Hilaire, 

I take it back.  

There are events that a Morph handles which it makes sense to
specialize/override for an individual morph. 

But dragEvent:MorphPosition: is an action one typically does not
override.  

It's callers are #MouseEvent>>dispatchWith: -- which you probably don't
want to mess with -- and specializations of
#Morph>>mouseButton1Down:localPosition: which you can already override. 

HTH, 

-KenD 

On 2025-02-08 04:02, Hilaire Fernandes via Cuis-dev wrote:

> Is there any reason drag event is not implemented as a property?
> 
> 1
> 2
> 3
> 4
> 
> Morph>>dragEvent: aMouseEvent localPosition: aPoint
> 
> aMouseEvent hand halo: nil.
> aMouseEvent hand grabMorph: self
> 
> contrary to other mouse events as :
> 
> 1
> 2
> 3
> 4
> 5
> 6
> 7
> 8
> 
> Morph>>mouseButton1Down: aMouseButtonEvent localPosition: localEventPosition
> "Handle a mouse down event.
> This message will only be sent to Morphs that answer true to #handlesMouseDown:"
> 
> "Allow instances to dynamically use properties for handling common events."
> self 
> valueOfProperty: #'mouseButton1Down:localPosition:' 
> ifPresentDo: [ :handler | handler value: aMouseButtonEvent value: localEventPosition ]
> 
> If I am right it makes impossible to add programmatically drag event handler to arbitrary Morph. You will have to subclass such Morph to add the behavior you want. 
> 
> Am I right or do I miss something? 
> 
> Thanks
> 
> -- 
> http://mamot.fr/@drgeo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20250208/2529ba04/attachment.htm>


More information about the Cuis-dev mailing list