[PD-dev] canvasdelete search method

Jonathan Wilkes jancsika at yahoo.com
Tue Nov 20 21:49:55 CET 2012

Oops, I created a strange subject for this thread.  I just mean that
these methods or externals search for matching objects then
do their stuff.

Also, I suppose one way to achieve something like I'm talking about
would be to have a [find] object that returnsthe order number for
matching objects-- then you could use the already existing delete
and connect methods.

Still, if it's possible it'd be more powerful to have the canvas methods
directly for this-- that way you could type the code for dynamic patching
completely in an object box, whereas using externals would require
the message box to create the objects and a separate message to the
external to find the objects to be connected.

[obj 20 20 foo, obj 20 40 bar, connectany foo 0 bar 0(--[sendcanvas]


[obj 20 20 foo, obj 20 40 bar(--[sendcanvas]

[foo(    [bar(

|           |

[find]    [find]
|           |

[pack 0 0]

[connect $1 0 $2 0(

Of course it gets more complex when working with lots of objects, but
in that case you'd probably be using wrapper abstractions either way, and
it's way easier to give things symbolic/numeric args that don't change than
try to keep up with creation ordering.


----- Original Message -----
> From: Jonathan Wilkes <jancsika at yahoo.com>
> To: "pd-dev at iem.at" <pd-dev at iem.at>
> Cc: 
> Sent: Tuesday, November 20, 2012 3:33 PM
> Subject: [PD-dev] canvasdelete search method
> I see canvasdelete adds a "delete" method for canvas.
> I'm thinking of adding a "deleteany" method that takes A_GIMME
> and deletes any object that matches the args.
> Examples:
> [deleteany foo(--[sendcanvas] deletes [foo] and [foo 12]
> [deleteany foo 12(--[sendcanvas] deletes [foo 12] but not [foo]
> Or maybe this interface would fit better with dynamic patching:
> [deleteany obj foo(--[sendcanvas] deletes [foo] and [foo 12] but not [foo(
> [deleteany text foo 12(--[sendcanvas] deletes comment "foo 12"
> [deleteany msg(--[sendcanvas] would delete all message boxes
> Basically combining the core functionality of the "find" method with 
> the "delete"
> method.
> It would be a mildly useful improvement, but could be very useful if there were
> something like this:
> [connectany "obj foo" 0 "obj bar" 0(--[sendcanvas] [foo]  
> [bar] becomes [foo]--[bar]
> Unfortunately Pd doesn't have sublists, and symbols with spaces are still 
> pretty
> clunky.
> Maybe connectany should be a separate external rather than a canvas method.  Can 
> anyone
> think of a decent interface for something like this?  It would vastly improve 
> the flexibility
> of dynamic patching.
> -Jonathan
> _______________________________________________
> Pd-dev mailing list
> Pd-dev at iem.at
> http://lists.puredata.info/listinfo/pd-dev

More information about the Pd-dev mailing list