| 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 |
tabnotebook .t \ |
| 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 .t.l -image testImage |
| 45 |
|
| 46 |
set attributes { |
| 47 |
graph1 "Graph \#1" red .t.graph1 |
| 48 |
graph2 "Graph \#2" green .t.graph2 |
| 49 |
graph3 "Graph \#3" cyan .t.graph3 |
| 50 |
graph5 "Graph \#5" yellow .t.graph5 |
| 51 |
graph6 one orange .t.l |
| 52 |
} |
| 53 |
|
| 54 |
foreach { entry label color window } $attributes { |
| 55 |
.t insert end -text $label -fill both |
| 56 |
} |
| 57 |
|
| 58 |
foreach label { there bunky another test of a widget } { |
| 59 |
set id [.t insert end -text $label] |
| 60 |
} |
| 61 |
|
| 62 |
set img [image create photo -file ./images/blt98.gif] |
| 63 |
.t tab configure $id -image label2 -tile $img |
| 64 |
|
| 65 |
table . \ |
| 66 |
.t 0,0 -fill both \ |
| 67 |
.s 1,0 -fill x |
| 68 |
|
| 69 |
table configure . r1 -resize none |
| 70 |
|
| 71 |
set index 0 |
| 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 $index -window $graph |
| 77 |
incr index |
| 78 |
} |
| 79 |
} |
| 80 |
|