Debian Codegraph @

demos/tabset3.tcl

raw
1 #!../src/bltwish
2
3 package require BLT
4 # --------------------------------------------------------------------------
5 # Starting with Tcl 8.x, the BLT commands are stored in their own
6 # namespace called "blt". The idea is to prevent name clashes with
7 # Tcl commands and variables from other packages, such as a "table"
8 # command in two different packages.
9 #
10 # You can access the BLT commands in a couple of ways. You can prefix
11 # all the BLT commands with the namespace qualifier "blt::"
12 #
13 # blt::graph .g
14 # blt::table . .g -resize both
15 #
16 # or you can import all the command into the global namespace.
17 #
18 # namespace import blt::*
19 # graph .g
20 # table . .g -resize both
21 #
22 # --------------------------------------------------------------------------
23 if { $tcl_version >= 8.0 } {
24 namespace import blt::*
25 namespace import -force blt::tile::*
26 }
27 source scripts/demo.tcl
28 #bltdebug 100
29
30 image create photo label1 -file ./images/mini-book1.gif
31 image create photo label2 -file ./images/mini-book2.gif
32 image create photo testImage -file ./images/txtrflag.gif
33
34 tabset .t \
35 -textside right \
36 -slant both \
37 -side right \
38 -samewidth yes \
39 -highlightcolor yellow \
40 -tiers 5 \
41 -scrollcommand { .s set } \
42 -scrollincrement 1
43
44 label .t.l -image testImage
45
46 #option add *Tabset.Tab.font -*-helvetica-bold-r-*-*-12-*-*-*-*-*-*-*
47 #option add *Tabset.Tab.fill both
48
49 set attributes {
50 graph1 "Graph \#1" pink
51 graph2 "Graph \#2" lightblue
52 graph3 "Graph \#3" orange
53 graph5 "Graph \#5" yellow
54 barchart2 "Barchart \#2" green
55 }
56
57 foreach { name label color } $attributes {
58 .t insert end $name -text $label \
59 -selectbackground ${color}3 \
60 -background ${color}3 \
61 -activebackground ${color}2
62 }
63
64 .t insert end Image -selectbackground salmon2 -background salmon3 \
65 -selectbackground salmon3 -activebackground salmon2 -window .t.l
66
67 set tabLabels {
68 Aarhus Aaron Ababa aback abaft abandon abandoned abandoning
69 abandonment abandons abase abased abasement abasements abases
70 abash abashed abashes abashing abasing abate abated abatement
71 abatements abater abates abating Abba abbe abbey abbeys abbot
72 abbots Abbott abbreviate abbreviated abbreviates abbreviating
73 abbreviation abbreviations Abby abdomen abdomens abdominal
74 abduct abducted abduction abductions abductor abductors abducts
75 Abe abed Abel Abelian Abelson Aberdeen Abernathy aberrant
76 aberration aberrations abet abets abetted abetter abetting
77 abeyance abhor abhorred abhorrent abhorrer abhorring abhors
78 abide abided abides abiding Abidjan Abigail Abilene abilities
79 ability abject abjection abjections abjectly abjectness abjure
80 abjured abjures abjuring ablate ablated ablates ablating
81 ablation ablative ablaze able abler ablest ably Abner abnormal
82 abnormalities abnormality abnormally Abo aboard abode abodes
83 abolish abolished abolisher abolishers abolishes abolishing
84 abolishment abolishments abolition abolitionist abolitionists
85 abominable abominate aboriginal aborigine aborigines abort
86 aborted aborting abortion abortions abortive abortively aborts
87 Abos abound abounded abounding abounds about above aboveboard
88 aboveground abovementioned abrade abraded abrades abrading
89 Abraham Abram Abrams Abramson abrasion abrasions abrasive
90 abreaction abreactions abreast abridge abridged abridges
91 abridging abridgment abroad abrogate abrogated abrogates
92 abrogating abrupt abruptly abruptness abscess abscessed
93 abscesses abscissa abscissas abscond absconded absconding
94 absconds absence absences absent absented absentee
95 absenteeism absentees absentia absenting absently absentminded
96 absents absinthe absolute absolutely absoluteness absolutes
97 absolution absolve absolved absolves absolving absorb
98 absorbed absorbency absorbent absorber absorbing absorbs
99 absorption absorptions absorptive abstain abstained abstainer
100 abstaining abstains abstention abstentions abstinence
101 abstract abstracted abstracting abstraction abstractionism
102 abstractionist abstractions abstractly abstractness
103 abstractor abstractors abstracts abstruse abstruseness
104 absurd absurdities absurdity absurdly Abu abundance abundant
105 abundantly abuse abused abuses abusing abusive abut abutment
106 abuts abutted abutter abutters abutting abysmal abysmally
107 abyss abysses Abyssinia Abyssinian Abyssinians acacia
108 academia academic academically academics academies academy
109 Acadia Acapulco accede acceded accedes accelerate accelerated
110 accelerates accelerating acceleration accelerations
111 accelerator accelerators accelerometer accelerometers accent
112 accented accenting accents accentual accentuate accentuated
113 accentuates accentuating accentuation accept acceptability
114 acceptable acceptably acceptance acceptances accepted
115 accepter accepters accepting acceptor acceptors accepts
116 access accessed accesses accessibility accessible accessibly
117 accessing accession accessions accessories accessors
118 accessory accident accidental accidentally accidently
119 accidents acclaim acclaimed acclaiming acclaims acclamation
120 acclimate acclimated acclimates acclimating acclimatization
121 acclimatized accolade accolades accommodate accommodated
122 accommodates accommodating accommodation accommodations
123 accompanied accompanies accompaniment accompaniments
124 accompanist accompanists accompany accompanying accomplice
125 accomplices accomplish accomplished accomplisher accomplishers
126 accomplishes accomplishing accomplishment accomplishments
127 accord accordance accorded accorder accorders according
128 accordingly accordion accordions accords accost accosted
129 accosting accosts account accountability accountable accountably
130 accountancy accountant accountants accounted accounting
131 accounts Accra accredit accreditation accreditations
132 accredited accretion accretions accrue accrued accrues
133 accruing acculturate acculturated acculturates acculturating
134 acculturation accumulate accumulated accumulates accumulating
135 accumulation accumulations accumulator accumulators
136 accuracies accuracy accurate accurately accurateness accursed
137 accusal accusation accusations accusative accuse accused
138 accuser accuses accusing accusingly accustom accustomed
139 accustoming accustoms ace aces acetate acetone acetylene
140 Achaean Achaeans ache ached aches achievable achieve achieved
141 achievement achievements achiever achievers achieves achieving
142 Achilles aching acid acidic acidities acidity acidly acids
143 acidulous Ackerman Ackley acknowledge acknowledgeable
144 acknowledged acknowledgement acknowledgements acknowledger
145 acknowledgers acknowledges acknowledging acknowledgment
146 acknowledgments acme acne acolyte acolytes acorn acorns
147 acoustic acoustical acoustically acoustician acoustics
148 acquaint acquaintance acquaintances acquainted acquainting
149 acquaints acquiesce acquiesced acquiescence acquiescent
150 acquiesces acquiescing acquirable acquire acquired acquires
151 acquiring acquisition acquisitions
152 }
153
154 for { set i 0 } { $i < 500 } { incr i } {
155 .t insert end [lindex $tabLabels $i] -state normal
156 }
157
158 scrollbar .s -command { .t view } -orient horizontal
159 radiobutton .left -text "Left" -variable side -value "left" \
160 -command { .t configure -side $side -rotate 90 }
161 radiobutton .right -text "Right" -variable side -value "right" \
162 -command { .t configure -side $side -rotate 270 }
163 radiobutton .top -text "Top" -variable side -value "top" \
164 -command { .t configure -side $side -rotate 0 }
165 radiobutton .bottom -text "Bottom" -variable side -value "bottom" \
166 -command { .t configure -side $side -rotate 0 }
167
168 table . \
169 .t 0,0 -fill both -cspan 2 \
170 .s 1,0 -fill x -cspan 2 \
171 .top 2,0 -cspan 2 \
172 .left 3,0 \
173 .right 3,1 \
174 .bottom 4,0 -cspan 2
175
176 table configure . r1 r3 r4 r2 -resize none
177 focus .t
178
179 .t focus 0
180
181 after 3000 {
182 .t move 0 after 3
183 .t tab configure [.t get 3] -state disabled
184 }
185
186 foreach file { graph1 graph2 graph3 graph5 barchart2 } {
187 namespace eval $file {
188 if { [string match graph* $file] } {
189 set graph [graph .t.$file]
190 } else {
191 set graph [barchart .t.$file]
192 }
193 source scripts/$file.tcl
194 .t tab configure $file -window $graph -fill both
195 }
196 }
197
198 .top invoke
199