---
** [bugs:#1238] scrollbars overlap canvas when patch is first opened**
**Status:** open **Group:** v0.46 **Created:** Sun Apr 24, 2016 09:46 AM UTC by danomatika **Last Updated:** Sun Apr 24, 2016 09:46 AM UTC **Owner:** nobody **Attachments:**
- [test2.pd](https://sourceforge.net/p/pure-data/bugs/1238/attachment/test2.pd) (137 Bytes; application/octet-stream)
Mac OSX 10.11.4, testing with Pd 0.46-4 & 0.47-0
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.
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.
I put in some prints and get roughly the following when first opening the attached test.pd patch:
~~~~ window size: 1 1 canvas size: 462 304 xview: 0.0 0.0021645021645021645 yview: 0.0 0.003289473684210526 ~~~~
A crude fix for testing is to basically filter out ridiculously tiny range values on lines 322:
~~~ if {[lindex [$tkcanvas xview] 0] == 0.0 && ([lindex [$tkcanvas xview] 1] == 1.0 || [lindex [$tkcanvas xview] 1] < 0.01)} { ~~~
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.
It seems to me like g_canvas should wait until the window exists *and* has been sized before doin it's initial call to pdtk_canvas_getscroll.
---
Sent from sourceforge.net because pd-dev@lists.iem.at is subscribed to https://sourceforge.net/p/pure-data/bugs/
To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/pure-data/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.