]> git.zerfleddert.de Git - micropolis/blob - src/tk/library/demos/mkHScale.tcl
926ed95e1e829caf228d7ebc6fd046a8668f7168
[micropolis] / src / tk / library / demos / mkHScale.tcl
1 # mkHScale w
2 #
3 # Create a top-level window that displays a horizontal scale.
4 #
5 # Arguments:
6 # w - Name to use for new top-level window.
7
8 proc mkHScale {{w .scale2}} {
9 catch {destroy $w}
10 toplevel $w
11 dpos $w
12 wm title $w "Horizontal Scale Demonstration"
13 wm iconname $w "Scale"
14 message $w.msg -font -Adobe-times-medium-r-normal--*-180* -aspect 300 \
15 -text "A bar and a horizontal scale are displayed below. If you click or drag mouse button 1 in the scale, you can change the width of the bar. Click the \"OK\" button when you're finished."
16 frame $w.frame -borderwidth 10
17 pack append $w.frame \
18 [frame $w.frame.top -borderwidth 15] {top expand frame sw} \
19 [scale $w.frame.scale -orient horizontal -length 280 -from 0 -to 250 \
20 -command "setWidth $w.frame.top.inner" -tickinterval 50 \
21 -bg Bisque1] {bottom expand frame nw}
22 pack append $w.frame.top \
23 [frame $w.frame.top.inner -geometry 20x40 -relief raised \
24 -borderwidth 2 -bg SteelBlue1] {expand frame sw}
25 $w.frame.scale set 20
26 button $w.ok -text OK -command "destroy $w"
27
28 pack append $w $w.msg {top fill} $w.frame {top expand fill} \
29 $w.ok {bottom fill}
30 }
31
32 proc setWidth {w width} {
33 $w config -geometry ${width}x40
34 }
Impressum, Datenschutz