OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / ALPHALINUX5 / util / ALPHALINUX5 / lib / blt2.4 / demos / tabnotebook2.tcl
1 #!../src/bltwish
2
3 package require BLT
4
5 # --------------------------------------------------------------------------
6 # Starting with Tcl 8.x, the BLT commands are stored in their own 
7 # namespace called "blt".  The idea is to prevent name clashes with
8 # Tcl commands and variables from other packages, such as a "table"
9 # command in two different packages.  
10 #
11 # You can access the BLT commands in a couple of ways.  You can prefix
12 # all the BLT commands with the namespace qualifier "blt::"
13 #  
14 #    blt::graph .g
15 #    blt::table . .g -resize both
16
17 # or you can import all the command into the global namespace.
18 #
19 #    namespace import blt::*
20 #    graph .g
21 #    table . .g -resize both
22 #
23 # --------------------------------------------------------------------------
24
25 if { $tcl_version >= 8.0 } {
26     namespace import blt::*
27     namespace import -force blt::tile::*
28 }
29 source scripts/demo.tcl
30
31 image create photo bgTile -file ./images/smblue_rock.gif
32 image create photo label1 -file ./images/mini-book1.gif
33 image create photo label2 -file ./images/mini-book2.gif
34 image create photo testImage -file ./images/txtrflag.gif
35
36 scrollbar .s -command { .tnb view } -orient horizontal
37 tabnotebook .tnb \
38     -relief sunken -bd 2 \
39     -textside right \
40     -samewidth yes -tiers 2 -slant right \
41     -scrollcommand { .s set } \
42     -tile bgTile 
43
44 label .tnb.l -image testImage
45
46 set attributes {
47     graph1 "Graph \#1" red      .tnb.graph1  
48     graph2 "Graph \#2" green    .tnb.graph2  
49     graph3 "Graph \#3" cyan     .tnb.graph3  
50     graph5 "Graph \#5" yellow   .tnb.graph5  
51     graph6 one          orange  .tnb.l       
52 }
53
54 foreach { entry label color window } $attributes {
55     .tnb insert end -text $label -fill both 
56 }
57
58 foreach label { there bunky another test of a widget } {
59     set id [.tnb insert end -text $label]
60 }
61
62 .tnb tab configure $id -image label2 
63
64 table . \
65     .tnb 0,0 -fill both \
66     .s 1,0 -fill x 
67
68 table configure . r1 -resize none
69
70 set index 0
71 foreach file { graph1 graph2 graph3 graph5 } {
72     set graph .tnb.$file
73     source scripts/$file.tcl
74     .tnb tab configure $index -window $graph
75     incr index
76 }
77