[PD] how to capture window-related mouse-events when toxy is discontinued?

Jonathan Wilkes jancsika at yahoo.com
Wed Nov 2 23:08:00 CET 2011

----- Original Message -----
> From: katja <katjavetter at gmail.com>
> To: pd-list at iem.at
> Cc: 
> Sent: Wednesday, November 2, 2011 1:45 PM
> Subject: Re: [PD] how to capture window-related mouse-events when toxy is discontinued?
> Wow, so many answers in so short time. Thank you all.
> To clarify, the moving squares in the video are sliders and / or
> radiobuttons, and they are moved in runtime. Attached is a patch
> demonstrating the idea, using [toxy/tot].
> As it seems, [iemguts/receivecanvas] could do this job indeed. It
> captures cursor position relative to the object's containing window,
> or relative to a parent if so desired. Phew, this will save my
> projects! I never knew about the existence of [iemguts/receivecanvas].
> It has no helpfile. I'd be happy to make one though. Hopefully the iem
> libs will stay a bit longer than toxy, though they're now categorized
> as 'unsupported, included libraries'.
> Jonathan, can you explain how a larger area of a polygon can be made
> reactive in runtime? Do you have a demo patch?

Sure.  The attached allows the 50x30 polygon to be click-dragged anywhere 
within the polygon-- basically ds hotspots happen in a 10x10 quadrant within 
the polygon when an x/y pair is specified with a field variable, so I'm forcing 
hotspots for the entire polygon by spacing all field value coordinates no more 
than 10 pixels from each other.  (You can overlay a simpler polygon if you want 
a cleaner-looking control surface.)

My example allows click-dragging, but leaves out the ability to click-select 
an object and move it by clicking a blank spot on the canvas.  You could do 
this by defining an additional data structure with a white rectangle, and make a 
matrix of scalars to fill the canvas.  Then when you click a "blank" area of the 
canvas, you're actually clicking the white scalar rectangle which will send a 
"click" message to its [struct], and you can then move the selected control-surface 
scalar to the corresponding quadrant.  (That's the hacky part.)


> I'm still interested in
> the data structure route, since I use them for parameter values
> anyway, and it is a bit underestimated aspect of Pure Data in my view.
> Katja
> _______________________________________________
> Pd-list at iem.at mailing list
> UNSUBSCRIBE and account-management -> 
> http://lists.puredata.info/listinfo/pd-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: movable-box2.pd
Type: application/octet-stream
Size: 2549 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20111102/0c6572f7/attachment-0001.obj>

More information about the Pd-list mailing list