Howdy all,
I played around a bit with forwarding canvas mouse click events to a [mouse]
object. This works fine using a bind to a global "#mouse" symbol, however this
means all objects receive events from all canvases.
How can I change this to be local canvas only, as in only [mouse] objects
within the canvas receive the events? I was thinking to generate a symbol with
the canvas id ala how [openpanel] and [savepanel] work:
sprintf(buf, "d%lx", (t_int)x);
x->x_s = gensym(buf);
x->x_canvas = canvas_getcurrent();
pd_bind(&x->x_obj.ob_pd, x->x_s)
However, this means the canvas mouse function would need to generate the
equivalent symbol each time the event is called in order to check if anything
is bound to it. This seems wasteful. I suppose I could add a cached symbol
somewhere, maybe to the g_canvas instance struct, however I'd like avoid that.
--------
Dan Wilcox
@danomatika <http://twitter.com/danomatika>
danomatika.com <http://danomatika.com/>
robotcowboy.com <http://robotcowboy.com/>
_______________________________________________
Pd-dev mailing list
[email protected]
https://lists.puredata.info/listinfo/pd-dev