<div class="markdown_content"><hr/>
<p><strong> <a class="alink" href="https://sourceforge.net/p/pure-data/bugs/1238/">[bugs:#1238]</a> scrollbars overlap canvas when patch is first opened</strong></p>
<p><strong>Status:</strong> open<br/>
<strong>Group:</strong> v0.46<br/>
<strong>Created:</strong> Sun Apr 24, 2016 09:46 AM UTC by danomatika<br/>
<strong>Last Updated:</strong> Sun Apr 24, 2016 09:46 AM UTC<br/>
<strong>Owner:</strong> nobody<br/>
<strong>Attachments:</strong></p>
<ul>
<li><a class="" href="https://sourceforge.net/p/pure-data/bugs/1238/attachment/test2.pd">test2.pd</a> (137 Bytes; application/octet-stream)</li>
</ul>
<p>Mac OSX 10.11.4, testing with Pd 0.46-4 & 0.47-0</p>
<p>I finally tracked down something that has annoyed me for a long time: when opening a patch, the canvas scrollbars will overlap objects on the bottom or right edge of the canvas window no matter how precise my alignment when I save the patch. Similarly, when you resize the canvas to something greater than the saved size, the scrollbars do not hide.</p>
<p>I poked around in pdtk_canvas.tcl and it looks like pdtk_canvas_getscroll is being called before the window has actually been sized. This means the initial call to show/hide the scrollbars uses a canvas window size of 1x1, so the scrollregion math results in a tiny scroll region and the scrollbars are always shown.</p>
<p>I put in some prints and get roughly the following when first opening the attached test.pd patch:</p>
<div class="codehilite"><pre>window size: 1 1
canvas size: 462 304
xview: 0.0 0.0021645021645021645
yview: 0.0 0.003289473684210526
</pre></div>


<p>A crude fix for testing is to basically filter out ridiculously tiny range values on lines 322:</p>
<div class="codehilite"><pre><span class="x">if </span><span class="err">{</span><span class="x">[lindex [</span><span class="p">$</span><span class="nv">tkcanvas</span><span class="x"> xview] 0] == 0.0 && ([lindex [</span><span class="p">$</span><span class="nv">tkcanvas</span><span class="x"> xview] 1] == 1.0 || [lindex [</span><span class="p">$</span><span class="nv">tkcanvas</span><span class="x"> xview] 1] < 0.01)} </span><span class="err">{</span><span class="x"></span>
</pre></div>


<p>and similarly with the yscrollbar on line 334, although this will fail with some window & canvas sizes so it's not the ideal fixes. I found this while paying with the attached test2.pd which shuld always open with scrollbars size the object is hidden to the lower right as the window size is smaller than the canvas size.</p>
<p>It seems to me like g_canvas should wait until the window exists <em>and</em> has been sized before doin it's initial call to pdtk_canvas_getscroll.</p>
<hr/>
<p>Sent from sourceforge.net because pd-dev@lists.iem.at is subscribed to <a href="https://sourceforge.net/p/pure-data/bugs/">https://sourceforge.net/p/pure-data/bugs/</a></p>
<p>To unsubscribe from further messages, a project admin can change settings at <a href="https://sourceforge.net/p/pure-data/admin/bugs/options.">https://sourceforge.net/p/pure-data/admin/bugs/options.</a>  Or, if this is a mailing list, you can unsubscribe from the mailing list.</p></div>