Ticket Hash: | 040cbad431f9524d0f1bb17ec97732922daa01b5 | |||
Title: | BLT zoomInfo stack not accessible, under undroidwish/vanillawish | |||
Status: | Closed | Type: | Incident | |
Severity: | Minor | Priority: | Immediate | |
Subsystem: | Resolution: | Fixed | ||
Last Modified: | 2020-03-07 20:44:17 | |||
Version Found In: | "Eppur si muove" | |||
User Comments: | ||||
anonymous added on 2020-02-11 21:41:47:
(text/html)
The following code inserts a user zoom level into the zoomInfo stack of BLT: <pre> proc AddZoomStack { } { global g zoomInfo set cmd {} foreach margin { xaxis yaxis x2axis y2axis } { foreach axis [$g $margin use] { set min [$g axis cget $axis -min]; set max [$g axis cget $axis -max] set c [list $g axis configure $axis -min $min -max $max] append cmd "$c\n" } } set zoomInfo($g,stack) [linsert $zoomInfo($g,stack) 0 $cmd] } </pre> This works under BLT 2.4z on Linux and Windows, fails with <pre> can't read "zoomInfo(.r.gr.c,stack)": no such variable </pre> under undroidwish-e5dc71ed9d-linux64 or vanillawish-e5dc71ed9d-linux64 chw added on 2020-02-11 22:17:12: Without having tested it myself would you like to try this snippet instead? proc AddZoomStack {g} { set cmd {} foreach margin { xaxis yaxis x2axis y2axis } { foreach axis [$g $margin use] { set min [$g axis cget $axis -min] set max [$g axis cget $axis -max] set c [list $g axis configure $axis -min $min -max $max] append cmd "$c\n" } } set ::blt::zoomInfo($g,stack) [linsert $::blt::zoomInfo($g,stack) 0 $cmd] } anonymous added on 2020-02-12 02:49:27: (text/html) Thank you, that solves this! <p> Which is very strange because earlier in the script I <pre> namespace import ::blt::* </pre> and it has always been sufficient (i.e. it WORKED) under native wish (tk 8.5.*) on the same machine, but failed if invoked with undroidwish/vanillawish. <p> With the explicit ::blt::zoomInfo, it finds the stack under both. <p> Thanks again, we can close this ticket! anonymous added on 2020-02-12 03:20:26: (text/html) Wait, spoke too soon. <p> Now it runs under undroidwish/vanillawish, but does NOT find it under the native wish 8.6, BLT 2.5.3. (it did work under native wish 8.5, BLT 2.4z) <p> The error message now is <pre> cant't read "::blt::zoomInfo(...,stack)": no such variable </pre> And, of course, taking out ::blt:: restores it to full function. anonymous added on 2020-02-12 03:50:25: (text/x-markdown) Sorry, another correction, it did NOT work under native wish 8.5 / BLT 2.4z under Linux. So, neither BLT 2.4z nor BLT 2.5 work with ::blt::zoomInfo() variant; and neither vanillawish nor undroidwish (with BLT 2.4z built-in) work with plain zoomInfo() variant. chw added on 2020-02-12 05:59:35: So we need to refine the proc like so (again untested): proc AddZoomStack {g} { set cmd {} foreach margin { xaxis yaxis x2axis y2axis } { foreach axis [$g $margin use] { set min [$g axis cget $axis -min] set max [$g axis cget $axis -max] set c [list $g axis configure $axis -min $min -max $max] append cmd "$c\n" } } if {[info exists ::blt::zoomInfo]} { set ::blt::zoomInfo($g,stack) [linsert $::blt::zoomInfo($g,stack) 0 $cmd] } elseif {[info global zoomInfo] eq "zoomInfo"} { set ::zoomInfo($g,stack) [linsert $::zoomInfo($g,stack) 0 $cmd] } } chw added on 2020-02-15 17:05:21: (text/x-markdown) Demoting this issue to "minor" "incident" because it uses undocumented features and can be solved by introspection at runtime. anonymous added on 2020-03-07 20:44:17: (text/x-markdown) Never got a chance to thank you for the fix! THANKS! |