<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span>The problem is for a subpatch that isn't vis'd:</span></div><div><br><span></span></div><div><span>[inlet]</span></div><div><span>|</span></div><div><span>[checkbutton]</span></div><div><span>|</span></div><div><span>[outlet]</span></div><div><br><span></span></div><div><span>Will give an error on "bang" because checkbutton_bang has:</span></div><div><span>sys_vgui("%s invoke\n", x-&gt;widget_id-&gt;s_name);<br></span></div><div>That could be solved by using a -variable option, but then that limits you because the nonzero value cannot be changed.*</div><div><br></div><div>So yeah, the best solution is stored state in the struct so you can access it in the c functions without caring about the vis state of the obj.&nbsp; Is that the idea behind the options_binbuf?</div><div><br></div><div>* also note that checkbutton's
 default behavior is the opposite from tgl:</div><div>tgl: zero = off, nonzero = on</div><div>checkbutton: onvalue = on, everything else = off<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"><div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"><font face="Arial" size="2"><hr size="1"><b><span style="font-weight:bold;">From:</span></b> Hans-Christoph Steiner &lt;hans@at.or.at&gt;<br><b><span style="font-weight: bold;">To:</span></b> Jonathan Wilkes &lt;jancsika@yahoo.com&gt;<br><b><span style="font-weight: bold;">Cc:</span></b> pd-dev List &lt;pd-dev@iem.at&gt;<br><b><span style="font-weight: bold;">Sent:</span></b> Wednesday, August 17, 2011 7:24 PM<br><b><span style="font-weight: bold;">Subject:</span></b> Re: tkwidgets<br></font><br><div id="yiv1252287210"><br><div><div>On Aug 17, 2011,
 at 6:23 PM, Jonathan Wilkes wrote:</div><br class="yiv1252287210Apple-interchange-newline"><blockquote type="cite"><div><div style="color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);font-family:times, serif;font-size:12pt;"><div><span>How does your private git branch differ from what's currently in svn?</span></div></div></div></blockquote><div><br></div><div>I pushed my git to github, my latest work is in the 'newentry' branch. &nbsp;I basically focused on the [entry] widget to see if I could get it going with this new approach.</div><div><br></div><div><a rel="nofollow" target="_blank" href="https://github.com/pd-projects/tkwidgets">https://github.com/pd-projects/tkwidgets</a></div><br><blockquote type="cite"><div><div style="color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);font-family:times, serif;font-size:12pt;">One thing I'd like to point out is that your tkwidgets suffer from the same problem tot/widget did -- by handling all the
 widget state in tcl you make it impossible to use your objects inside a subpatch/abstraction that doesn't have a visible canvas (because the widget no longer exists).&nbsp; I was considering create a "master" widget as a child of the main window and sync it to the widget drawn on the canvas, but that seems like a lot of trouble.&nbsp; Is there some other workaround?<br></div></div></blockquote><div><br></div><div>That is true, but tkwidgets are all about using Tk widgets in Pd as easily as possible. &nbsp;If the Tk widget is not drawn to the screen, then the Tk widget is not involved. &nbsp;What is the problem in particular? &nbsp;You want to change its state while its not visible? &nbsp;I think the idea there is to have the state stored in the standard struct as a dump from the Tk widget. &nbsp;So when its not visible, store the state-changes, when it becomes visible, dump the state to the Tk widget.</div><br><blockquote type="cite"><div><div
 style="color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);font-family:times, serif;font-size:12pt;">Another thing: to get "Pd-style" interaction, bind $canvas &lt;&lt;EditMode&gt;&gt; to a proc that sets -state to disabled  for all tkwidgets in that $canvas when editmode == 1.&nbsp; That way you don't end up triggering the widget when you want to edit it.<br></div></div></blockquote><div><br></div><div>Yeah, tkwidgets was mostly written about the same time as I starting the pd-gui-rewrite. &nbsp;As I rewrote a lot of pd-gui, I realized I should wait on tkwidgets since I could fix a lot of things in pd-gui first. &nbsp;The &lt;&lt;EditMode&gt;&gt; message is one example. &nbsp;tkwdigets is not complete yet, so this is not fully in there. &nbsp;I think the [entry] in github does this kind of stuff.</div><div><br></div><div>.hc</div><br><blockquote type="cite"><div><div style="color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);font-family:times,
 serif;font-size:12pt;"><div><blockquote style="border-left-width:2px;border-left-style:solid;border-left-color:rgb(16, 16, 255);margin-left:5px;padding-left:5px;"><div style="font-family:times new roman, new york, times, serif;font-size:12pt;"><div style="font-family:times new roman, new york, times, serif;font-size:12pt;"><font face="Arial" size="2"> Hans-Christoph Steiner &lt;<a rel="nofollow" ymailto="mailto:hans@at.or.at" target="_blank" href="mailto:hans@at.or.at">hans@at.or.at</a>&gt;<br><b><span style="font-weight:bold;">To:</span></b> Jonathan Wilkes &lt;<a rel="nofollow" ymailto="mailto:jancsika@yahoo.com" target="_blank" href="mailto:jancsika@yahoo.com">jancsika@yahoo.com</a>&gt;<br><b><span style="font-weight:bold;">Cc:</span></b> pd-dev List &lt;<a rel="nofollow" ymailto="mailto:pd-dev@iem.at" target="_blank" href="mailto:pd-dev@iem.at">pd-dev@iem.at</a>&gt;<br><b><span style="font-weight:bold;">Sent:</span></b> Wednesday, August 17, 2011
 2:54 PM<br><b><span style="font-weight:bold;">Subject:</span></b> Re: tkwidgets<br></font><br><div id="yiv1252287210"><div><br></div><div>Hey Jonathan,</div><div><br></div><div>I'm cc'ing pd-dev since this is a topic that could interest others and others could contribute to. &nbsp;I've started a private git branch of tkwidgets that I intent to push once I get somewhere with it. &nbsp;The idea is to try out a new idea for how GUI objects can work. &nbsp;Basically, I think I can make it so that Tcl handles more of the interaction with the user, minimizing on pd-gui &lt;--&gt; pd communications, and making it easier to write GUI objects. &nbsp;Its not trivial to do, but should be doable.</div><div><br></div><div>.hc</div><div><br></div><br><div><div>On Aug 17, 2011, at 12:26 PM, Jonathan Wilkes wrote:</div><br class="yiv1252287210Apple-interchange-newline"><blockquote type="cite"><div><div style="color:#000;background-color:#fff;font-family:times new
 roman, new york, times, serif;font-size:12pt;"><div><span>Never mind, I see it now inside canvas_vis... too bad canvas' "window" subcommand doesn't have something like pack's "-in" option...</span></div><div><br><span></span></div><div><span>But I guess I could make a toplevel checkbutton widget and just manually clone it.<br></span></div><div><br><span></span></div><div><span>-Jonathan<br></span></div><div><br><blockquote style="border-left:2px solid rgb(16, 16, 255);margin-left:5px;padding-left:5px;"><div style="font-family:times new roman, new york, times, serif;font-size:12pt;"><div style="font-family:times new roman, new york, times, serif;font-size:12pt;"><font face="Arial" size="2"><hr size="1"><b><span style="font-weight:bold;">From:</span></b> Jonathan Wilkes &lt;<a rel="nofollow" ymailto="mailto:jancsika@yahoo.com" target="_blank" href="mailto:jancsika@yahoo.com">jancsika@yahoo.com</a>&gt;<br><b><span style="font-weight:bold;">To:</span></b>
 Hans- Christoph Steiner &lt;<a rel="nofollow" ymailto="mailto:hans@at.or.at" target="_blank" href="mailto:hans@at.or.at">hans@at.or.at</a>&gt;<br><b><span style="font-weight:bold;">Sent:</span></b> Wednesday, August 17, 2011 3:14 AM<br><b><span style="font-weight:bold;">Subject:</span></b> tkwidgets<br></font><br><div id="yiv1252287210"><div style="color:#000;background-color:#fff;font-family:times new roman, new york, times, serif;font-size:12pt;"><div>Hi Hans,</div><div>&nbsp;&nbsp;&nbsp;&nbsp; Do I have it right that your tkwidgets get destroyed when the containing patch is vis'd 0?&nbsp; If so, any hints on how this happens?</div><div><br></div><div>Specifically, I'm playing around with [checkbutton], and even if I comment out everything in eraseme and checkbutton_free, and every single "destroy" subcommand, I still get a tcl error when sending a bang or float to a [checkbutton] that's in a subpatch with no window
 mapped:</div><div><br></div><div>(Tcl) INVALID COMMAND NAME: invalid command name ".x252a690.c.widget25272b0"<br>&nbsp;&nbsp;&nbsp; while executing<br>".x252a690.c.widget25272b0 cget -onvalue"<br>&nbsp;&nbsp;&nbsp; ("uplevel" body line 2)<br>&nbsp;&nbsp;&nbsp; invoked from within<br>"uplevel #0 $cmd_from_pd"</div><div><br></div><div><br></div></div></div><br><br></div></div></blockquote></div></div></div></blockquote></div><br><div> <span class="yiv1252287210Apple-style-span" style="border-collapse:separate;border-spacing:0px 0px;color:rgb(0, 0, 0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:auto;text-indent:0px;text-transform:none;orphans:2;white-space:normal;widows:2;word-spacing:0px;"><br class="yiv1252287210Apple-interchange-newline"><span class="yiv1252287210Apple-style-span" style="border-collapse:separate;border-spacing:0px 0px;color:rgb(0, 0,
 0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:auto;text-indent:0px;text-transform:none;orphans:2;white-space:normal;widows:2;word-spacing:0px;"><div><br style="font-family:Tahoma;"></div><div>----------------------------------------------------------------------------<br style="font-family:Tahoma;"></div><div><br class="yiv1252287210khtml-block-placeholder"></div><div>Man has survived hitherto because he was too ignorant to know how to realize his wishes.&nbsp;&nbsp;Now that he can realize them, he must either change them, or perish. &nbsp; &nbsp;-William Carlos Williams</div><br class="yiv1252287210Apple-interchange-newline"></span></span> </div><br></div><br><br></div></div></blockquote></div></div></div></blockquote></div><br><div> <span class="yiv1252287210Apple-style-span" style="font-size:12px;"><div><br
 class="yiv1252287210Apple-interchange-newline"><br></div><div>----------------------------------------------------------------------------<br></div><div><br class="yiv1252287210khtml-block-placeholder"></div><div>"We have nothing to fear from love and commitment." - New York Senator&nbsp;Diane Savino, trying to convince the NY Senate to pass a gay marriage bill</div></span> </div><br></div><br><br></div></div></blockquote></div></div></body></html>