File: tabnotebook

package info (click to toggle)
itcl3.0 3.0.1-3
  • links: PTS
  • area: main
  • in suites: potato
  • size: 10,124 kB
  • ctags: 3,519
  • sloc: tcl: 32,416; ansic: 12,683; sh: 3,911; makefile: 693; awk: 273; perl: 265
file content (76 lines) | stat: -rw-r--r-- 2,355 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/sh
# ----------------------------------------------------------------------
#  DEMO: tabnotebook in [incr Widgets]
# ----------------------------------------------------------------------
#\
exec itkwish -f "$0" ${1+"$@"}
package require -exact Iwidgets 2.2

# itkwish interprets the rest...
# ----------------------------------------------------------------------
option add *textBackground seashell
option add *Tabnotebook.backdrop DimGray
option add *Scale.width 8
. configure -background white

iwidgets::tabnotebook .tnb -width 5i -height 3i
pack .tnb -padx 4 -pady 4
 
# Page #1
# ----------------------------------------------------------------------
set page [.tnb add -label "Personal Info"]

iwidgets::entryfield $page.name -labeltext "Name:" -labelpos nw
pack $page.name
iwidgets::entryfield $page.addr -labeltext "Address:" -labelpos nw
pack $page.addr
iwidgets::entryfield $page.addr2 -labeltext "City, State:" -labelpos nw
pack $page.addr2
iwidgets::entryfield $page.email -labeltext "E-mail:" -labelpos nw
pack $page.email


# Page #2
# ----------------------------------------------------------------------
set page [.tnb add -label "Favorite Color"]

frame $page.sample -width 20 -height 20 \
    -borderwidth 2 -relief raised
pack $page.sample -fill both -pady 4
scale $page.r -label "Red" -orient horizontal \
    -from 0 -to 255 -command "set_color $page"
pack $page.r -fill x
scale $page.g -label "Green" -orient horizontal \
    -from 0 -to 255 -command "set_color $page"
pack $page.g -fill x
scale $page.b -label "Blue" -orient horizontal \
    -from 0 -to 255 -command "set_color $page"
pack $page.b -fill x

proc set_color {page {val 0}} {
    set r [$page.r get]
    set g [$page.g get]
    set b [$page.b get]
    set color [format "#%.2x%.2x%.2x" $r $g $b]
    $page.sample configure -background $color
}
set_color $page
 

# Page #3
# ----------------------------------------------------------------------
set page [.tnb add -label "Blank Page"]

label $page.title -text "(put your widgets here)" \
    -background black -foreground white \
    -width 25 -height 3
pack $page.title -expand yes -fill both


iwidgets::optionmenu .orient -labeltext "Tabs:" -items {n s e w} -command {
    .tnb configure -tabpos [.orient get]
}
pack .orient -padx 4 -pady 4

.tnb view "Personal Info"
.tnb configure -tabpos [.orient get]