From 50b1e01cfc4b630f1664ee4602b89fab30be19e9 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Wed, 13 Sep 2023 11:28:07 -0400 Subject: [PATCH] Corrected the scrollbar function on the parameterized device generation dialog window. The window is now made to fit the list of parameters when it is made, but can be reduced in size which allows the scrollbar to function. Event bindings for the mouse scrollwheel were added so that it can subsitute for the scrollbar within the parameter window. --- tcltk/toolkit.tcl | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/tcltk/toolkit.tcl b/tcltk/toolkit.tcl index fcab3601..b18f5496 100644 --- a/tcltk/toolkit.tcl +++ b/tcltk/toolkit.tcl @@ -1259,6 +1259,20 @@ proc magic::gencell_update {{command {}}} { } } +#------------------------------------------------------------- +# updateParamsScrollRegion --- +# +# Change the canvas size when the parameter window changes +# size so that the scrollbar works correctly. +#------------------------------------------------------------- + +proc updateParamsScrollRegion {} { + set bbox [.params.body.area bbox all] + .params.body.area configure -scrollregion $bbox + .params.body.area configure -width [lindex $bbox 2] + .params.body.area configure -height [lindex $bbox 3] +} + #------------------------------------------------------------- # gencell_dialog --- # @@ -1404,6 +1418,13 @@ proc magic::gencell_dialog {instname gencell_type library parameters} { frame .params.body.area.edits .params.body.area create window 0 0 -anchor nw -window .params.body.area.edits .params.body.area config -yscrollcommand {.params.body.sb set} + + # Make sure scrollbar tracks any window size changes + bind .params updateParamsScrollRegion + + # Allow mouse wheel to scroll the window up and down. + bind .params.body.area {.params.body.area yview scroll -1 units} + bind .params.body.area {.params.body.area yview scroll +1 units} } if {$instname == {}} { @@ -1441,12 +1462,6 @@ proc magic::gencell_dialog {instname gencell_type library parameters} { # Make sure the window is raised raise .params - - # Wait for window to become visible to set the scroll region - if {[catch {winfo children .params.body.area}]} { - tkwait visibility .params.body.area - } - .params.body.area config -scrollregion [.params.body.area bbox all] } #-------------------------------------------------------------