2 # ----------------------------------------------------------------------
3 # DEMO: notebook in [incr Widgets]
4 # ----------------------------------------------------------------------
6 exec itkwish "$0" ${1+"$@"}
7 package require Iwidgets 3.0
9 # itkwish interprets the rest...
10 # ----------------------------------------------------------------------
11 option add *textBackground seashell
12 option add *Scale.width 8
13 . configure -background white
15 iwidgets::optionmenu .pages -labeltext "Page:" -command {
18 pack .pages -padx 4 -pady 4
19 .pages insert end "Personal Info" "Favorite Color" "Blank Page"
22 iwidgets::notebook .nb -width 3i -height 2.6i
23 pack .nb -padx 4 -pady 4
26 # ----------------------------------------------------------------------
27 set page [.nb add -label "Personal Info"]
29 iwidgets::entryfield $page.name -labeltext "Name:" -labelpos nw
31 iwidgets::entryfield $page.addr -labeltext "Address:" -labelpos nw
33 iwidgets::entryfield $page.addr2 -labeltext "City, State:" -labelpos nw
35 iwidgets::entryfield $page.email -labeltext "E-mail:" -labelpos nw
40 # ----------------------------------------------------------------------
41 set page [.nb add -label "Favorite Color"]
43 frame $page.sample -width 20 -height 20 \
44 -borderwidth 2 -relief raised
45 pack $page.sample -fill both -pady 4
46 scale $page.r -label "Red" -orient horizontal \
47 -from 0 -to 255 -command "set_color $page"
49 scale $page.g -label "Green" -orient horizontal \
50 -from 0 -to 255 -command "set_color $page"
52 scale $page.b -label "Blue" -orient horizontal \
53 -from 0 -to 255 -command "set_color $page"
56 proc set_color {page {val 0}} {
60 set color [format "#%.2x%.2x%.2x" $r $g $b]
61 $page.sample configure -background $color
67 # ----------------------------------------------------------------------
68 set page [.nb add -label "Blank Page"]
70 label $page.title -text "(put your widgets here)" \
71 -background black -foreground white \
73 pack $page.title -expand yes -fill both
76 .nb view "Personal Info"