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

Subversion Repositories or1k_old

[/] [or1k_old/] [tags/] [start/] [insight/] [itcl/] [iwidgets3.0.0/] [demos/] [spinner] - Blame information for rev 1765

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
#!/bin/sh
2
# ----------------------------------------------------------------------
3
#  DEMO: spinner 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
 
13
proc spinMonth {win step} {
14
    set months {
15
        January February March April
16
        May June July August September
17
        October November December
18
    }
19
 
20
    set index [expr [lsearch $months [$win get]] + $step]
21
 
22
    if {$index < 0} {set index 11}
23
    if {$index > 11} {set index 0}
24
 
25
    $win delete 0 end
26
    $win insert 0 [lindex $months $index]
27
}
28
 
29
iwidgets::spinner .sm -labeltext "Month:" -width 10 -fixed 10 \
30
    -decrement {spinMonth .sm -1} -increment {spinMonth .sm 1}
31
 
32
pack .sm
33
.sm insert 0 "January"

powered by: WebSVN 2.1.0

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