OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [itcl/] [iwidgets3.0.0/] [demos/] [tabnotebook] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
#!/bin/sh
2
# ----------------------------------------------------------------------
3
#  DEMO: tabnotebook in [incr Widgets]
4
# ----------------------------------------------------------------------
5
#\
6
exec itkwish "$0" ${1+"$@"}
7
package require Iwidgets 3.0
8
 
9
# itkwish interprets the rest...
10
# ----------------------------------------------------------------------
11
option add *textBackground seashell
12
option add *Tabnotebook.backdrop DimGray
13
option add *Scale.width 8
14
. configure -background white
15
 
16
iwidgets::tabnotebook .tnb -width 5i -height 3i
17
pack .tnb -padx 4 -pady 4
18
 
19
# Page #1
20
# ----------------------------------------------------------------------
21
set page [.tnb add -label "Personal Info"]
22
 
23
iwidgets::entryfield $page.name -labeltext "Name:" -labelpos nw
24
pack $page.name
25
iwidgets::entryfield $page.addr -labeltext "Address:" -labelpos nw
26
pack $page.addr
27
iwidgets::entryfield $page.addr2 -labeltext "City, State:" -labelpos nw
28
pack $page.addr2
29
iwidgets::entryfield $page.email -labeltext "E-mail:" -labelpos nw
30
pack $page.email
31
 
32
 
33
# Page #2
34
# ----------------------------------------------------------------------
35
set page [.tnb add -label "Favorite Color"]
36
 
37
frame $page.sample -width 20 -height 20 \
38
    -borderwidth 2 -relief raised
39
pack $page.sample -fill both -pady 4
40
scale $page.r -label "Red" -orient horizontal \
41
    -from 0 -to 255 -command "set_color $page"
42
pack $page.r -fill x
43
scale $page.g -label "Green" -orient horizontal \
44
    -from 0 -to 255 -command "set_color $page"
45
pack $page.g -fill x
46
scale $page.b -label "Blue" -orient horizontal \
47
    -from 0 -to 255 -command "set_color $page"
48
pack $page.b -fill x
49
 
50
proc set_color {page {val 0}} {
51
    set r [$page.r get]
52
    set g [$page.g get]
53
    set b [$page.b get]
54
    set color [format "#%.2x%.2x%.2x" $r $g $b]
55
    $page.sample configure -background $color
56
}
57
set_color $page
58
 
59
 
60
# Page #3
61
# ----------------------------------------------------------------------
62
set page [.tnb add -label "Blank Page"]
63
 
64
label $page.title -text "(put your widgets here)" \
65
    -background black -foreground white \
66
    -width 25 -height 3
67
pack $page.title -expand yes -fill both
68
 
69
 
70
iwidgets::optionmenu .orient -labeltext "Tabs:" -command {
71
    .tnb configure -tabpos [.orient get]
72
}
73
pack .orient -padx 4 -pady 4
74
.orient insert end n s e w
75
 
76
.tnb view "Personal Info"
77
.tnb configure -tabpos [.orient get]

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.