1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
|
#
# scroll.tk
#
# create a canvas with vertical scroll bar
# create a window frame inside the canvas
# create windgets inside this window frame
# need to fix scrollregion - done
# need to fix canvas width, height - done
# need to fix destroy list canvas ? when model rebuilds
# need to incorporate this routine with build label entry columns in utils.tk
proc scroll(build) name {
build_Title $name "Scroll"
set cmd [build_CmdFrame $name cmd]
if { [winfo exists .scroll.cmd.f.canvas] } {
return
}
set sc [scroll(canvas) $cmd 300 150 {0 0 1000 500}]
build_LabelEntryColumns $sc.f le1 \
[list label "Range" [concat \
[array_to_list Model Varb_Names] \
[array_to_list Model Param_Names] \
[array_to_list Model Funct_Names]]] \
[list dentry "Minimum" [concat \
[array_to_list Defaults Varb_Min] \
[array_to_list Defaults Param_Min] \
[array_to_list Defaults Funct_Min]]] \
[list dentry "Maximum" [concat \
[array_to_list Defaults Varb_Max] \
[array_to_list Defaults Param_Max] \
[array_to_list Defaults Funct_Max]]]
build_LabelEntryColumns $sc.f le2 \
[list label "Range" [concat \
[array_to_list Model Varb_Names] \
[array_to_list Model Param_Names] \
[array_to_list Model Funct_Names]]] \
[list dentry "Minimum" [concat \
[array_to_list Defaults Varb_Min] \
[array_to_list Defaults Param_Min] \
[array_to_list Defaults Funct_Min]]] \
[list dentry "Maximum" [concat \
[array_to_list Defaults Varb_Max] \
[array_to_list Defaults Param_Max] \
[array_to_list Defaults Funct_Max]]]
build_LabelEntryColumns $sc.f le3 \
[list label "Range" [concat \
[array_to_list Model Varb_Names] \
[array_to_list Model Param_Names] \
[array_to_list Model Funct_Names]]] \
[list dentry "Minimum" [concat \
[array_to_list Defaults Varb_Min] \
[array_to_list Defaults Param_Min] \
[array_to_list Defaults Funct_Min]]] \
[list dentry "Maximum" [concat \
[array_to_list Defaults Varb_Max] \
[array_to_list Defaults Param_Max] \
[array_to_list Defaults Funct_Max]]]
build_DismissButtonbar $cmd dbbar "window(dismiss) scroll"
pack $cmd -fill x
tkwait visibility $sc.f
set dx [winfo width $sc.f]
set dy [winfo height $sc.f]
$sc config -scrollregion "0 0 $dx $dy"
$sc config -width $dx
}
proc scroll(canvas) {parent width height region args} {
set pf [frame $parent.f]
canvas $pf.canvas -width $width -height $height \
-scrollregion $region \
-yscrollcommand [list $pf.yscroll set]
scrollbar $pf.yscroll -orient vertical \
-command [list $pf.canvas yview]
set cf [frame $pf.canvas.f -bd 0]
$pf.canvas create window 0 0 -anchor nw -window $cf
pack $pf.yscroll -side right -fill y
pack $pf.canvas -side left -fill both -expand true
pack $pf -side top -fill both -expand true
return $pf.canvas
}
|