~ubuntu-branches/ubuntu/vivid/gcl/vivid

« back to all changes in this revision

Viewing changes to gcl-tk/demos/mkHScale.tcl

  • Committer: Bazaar Package Importer
  • Author(s): Camm Maguire
  • Date: 2002-03-04 14:29:59 UTC
  • Revision ID: james.westby@ubuntu.com-20020304142959-dey14w08kr7lldu3
Tags: upstream-2.5.0.cvs20020219
ImportĀ upstreamĀ versionĀ 2.5.0.cvs20020219

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
    button $w.ok -text OK -command "destroy $w"
 
18
    pack $w.msg $w.frame $w.ok -side top -fill x
 
19
 
 
20
    frame $w.frame.top -borderwidth 15
 
21
    scale $w.frame.scale -orient horizontal -length 280 -from 0 -to 250 \
 
22
            -command "setWidth $w.frame.top.inner" -tickinterval 50 \
 
23
            -bg Bisque1
 
24
    pack $w.frame.top -side top -expand yes -anchor sw
 
25
    pack $w.frame.scale -side bottom -expand yes -anchor nw
 
26
 
 
27
    frame $w.frame.top.inner  -relief raised -borderwidth 2 \
 
28
            -bg SteelBlue1
 
29
    pack $w.frame.top.inner -expand yes -anchor sw
 
30
    $w.frame.scale set 20
 
31
}
 
32
 
 
33
proc setWidth {w width} {
 
34
    $w config -width $width
 
35
}