Debian Codegraph @

demos/tabset2.tcl

raw
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 { .t view } -orient horizontal
37 tabset .t \
38 -relief flat \
39 -bd 2 \
40 -textside right \
41 -samewidth yes \
42 -tiers 2 \
43 -slant right \
44 -scrollcommand { .s set } \
45 -tile bgTile \
46 -scrollincrement 1 -selectforeground green2
47
48 label .t.l -image testImage
49
50 set attributes {
51 graph1 "Graph \#1" red .t.graph1
52 graph2 "Graph \#2" green .t.graph2
53 graph3 "Graph \#3" cyan .t.graph3
54 graph5 "Graph \#5" yellow .t.graph5
55 graph6 one orange .t.l
56 }
57
58 foreach { entry label color window } $attributes {
59 .t insert end $entry -text $label -fill both
60 }
61
62 .t insert end \
63 there bunky another test of \
64 a -image label2 widget
65
66 table . \
67 .t 0,0 -fill both \
68 .s 1,0 -fill x
69
70 table configure . r1 -resize none
71
72 foreach file { graph1 graph2 graph3 graph5 } {
73 namespace eval $file {
74 set graph [graph .t.$file]
75 source scripts/$file.tcl
76 .t tab configure $file -window $graph
77 }
78 }
79