<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div id="yui_3_16_0_1_1440196010699_7525">Hi list,</div><div dir="ltr" id="yui_3_16_0_1_1440196010699_7571">I just coded a new class called "field" to be used in conjunction with a new data structure type called "canvas".  (I got a prototype of the "canvas" type working awhile back, but this should be a bit more refined.)<br></div><div id="yui_3_16_0_1_1440196010699_7687" dir="ltr"><br></div><div id="yui_3_16_0_1_1440196010699_7692" dir="ltr">You start with a struct:</div><div id="yui_3_16_0_1_1440196010699_7693" dir="ltr">[struct foo float x float y canvas a b]</div><div id="yui_3_16_0_1_1440196010699_7694" dir="ltr"><br></div><div id="yui_3_16_0_1_1440196010699_7695" dir="ltr">Then create a scalar from this struct.</div><div id="yui_3_16_0_1_1440196010699_7717" dir="ltr"><br></div><div id="yui_3_16_0_1_1440196010699_7742" dir="ltr">The scalar will have an "x" value, a "y" value, and a canvas "a" which gets filled with the contents of an abstraction "b.pd" that is somewhere in Pd's search path.</div><div id="yui_3_16_0_1_1440196010699_7743" dir="ltr"><br></div><div id="yui_3_16_0_1_1440196010699_7744" dir="ltr">Now here's the neat thing-- inside the newly instantiated "b.pd" you can do this:</div><div id="yui_3_16_0_1_1440196010699_7745" dir="ltr"><br></div><div id="yui_3_16_0_1_1440196010699_7746" dir="ltr">[loadbang]</div><div id="yui_3_16_0_1_1440196010699_7772" dir="ltr">|</div><div id="yui_3_16_0_1_1440196010699_7773" dir="ltr">[field x]</div><div id="yui_3_16_0_1_1440196010699_7774" dir="ltr">|</div><div id="yui_3_16_0_1_1440196010699_7775" dir="ltr">[print x]</div><div id="yui_3_16_0_1_1440196010699_7816" dir="ltr"><br></div><div id="yui_3_16_0_1_1440196010699_7817" dir="ltr">When you instantiate that scalar above, its canvas "a" will print out the value of the "x" field for that scalar.  In other words, the "a" canvas has access to all the field data of the scalar it belongs to.</div><div id="yui_3_16_0_1_1440196010699_8019" dir="ltr"><br></div><div id="yui_3_16_0_1_1440196010699_8020" dir="ltr">The interface is exactly like [v], which means you can do this:</div><div id="yui_3_16_0_1_1440196010699_7869" dir="ltr"><br></div><div id="yui_3_16_0_1_1440196010699_7842" dir="ltr">[loadbang]</div><div id="yui_3_16_0_1_1440196010699_7867" dir="ltr">|</div><div id="yui_3_16_0_1_1440196010699_7868" dir="ltr">[f]x[+ 1]</div><div id="yui_3_16_0_1_1440196010699_7922" dir="ltr">|</div><div id="yui_3_16_0_1_1440196010699_7977" dir="ltr">[field x]</div><div id="yui_3_16_0_1_1440196010699_7990" dir="ltr"><br></div><div id="yui_3_16_0_1_1440196010699_7991" dir="ltr">This will _change_ the value of "x" for the parent scalar.  So if you drew a little rectangle, when you instantiate your scalar you'll see it moving across the screen.<br></div><div id="yui_3_16_0_1_1440196010699_8004" dir="ltr"><br></div><div id="yui_3_16_0_1_1440196010699_8005" dir="ltr">Notice:</div><div id="yui_3_16_0_1_1440196010699_8021" dir="ltr">* no gpointers necessary</div><div id="yui_3_16_0_1_1440196010699_8039" dir="ltr">* no need to type the template name (since you can only have one per scalar)</div><div dir="ltr"><br></div><div dir="ltr">The way I think of this is like a sprite of Mario, where you can click on the sprite and see the code which is controling Mario (making him move, sing, etc.).<br></div><div dir="ltr"><br></div><div dir="ltr">Unfortunately the implementation is subject to my same uncertainty about realloc and pointers to array data.  But I'm hoping that either a) I'm wrong about that problem or b) someone will solve that problem and I'll use the same solution here.</div><div dir="ltr"><br></div><div dir="ltr">I'll try to post some screencasts once I do some more testing.</div><div dir="ltr"><br></div><div dir="ltr">Best,</div><div dir="ltr">Jonathan<br></div><div dir="ltr"><br></div></div></body></html>