[PD] In 2019 is there a way to detect mouse down/up?

Dan Wilcox danomatika at gmail.com
Fri Mar 15 11:30:04 CET 2019


I would use #mouse to match the internal send names like #notein, etc. :)

Actually, you can receive messages to [notein] using [r #notein] so I could imagine a similar set of mouse objects which work in the same manner ala [mouseup], [mousedown], [mousemove], & possibly [mousedrag]. We can look into the code on those objects and replicate how they work to avoid the missing receiver name.

Honestly, this should be something built in however I would first make sure there isn't any sort of major performance penalty (probably not). Chris's comment about "in 2019" is spot on...

> On Mar 15, 2019, at 11:06 AM, pd-list-request at lists.iem.at wrote:
> 
> From: Jean-Yves Gratius <jyg at gumo.fr <mailto:jyg at gumo.fr>>
> To: pd-list at lists.iem.at <mailto:pd-list at lists.iem.at>
> Subject: Re: [PD] In 2019 is there a way to detect mouse down/up?
> Message-ID: <cc397066-5e73-1e69-5c7e-d55713c4d275 at gumo.fr <mailto:cc397066-5e73-1e69-5c7e-d55713c4d275 at gumo.fr>>
> Content-Type: text/plain; charset="utf-8"; Format="flowed"
> 
> Not sure it can be considered as a vanilla solution, but you should edit 
> tcl/pdtk_canvas.tcl file and add one line in the proc 
> pdtk_canvas_mouseup (line 216) :
> 
> proc pdtk_canvas_mouseup {tkcanvas x y b} {
>     set mytoplevel [winfo toplevel $tkcanvas]
>     pdsend "$mytoplevel mouseup [$tkcanvas canvasx $x] [$tkcanvas 
> canvasy $y] $b"
>     pdsend "MOUSE mouseup [$tkcanvas canvasx $x] [$tkcanvas canvasy $y] $b"
> }
> (see attachment)
> 
> Then you'll always need to have a receiver (named "MOUSE") in your 
> patch, else you will receive error messages in pd console.
> If you click on a bang object in your patch, you can then listen to the 
> MOUSE receiver and wait for the message "mouseup"

--------
Dan Wilcox
@danomatika <http://twitter.com/danomatika>
danomatika.com <http://danomatika.com/>
robotcowboy.com <http://robotcowboy.com/>



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20190315/82867e4f/attachment.html>


More information about the Pd-list mailing list