home *** CD-ROM | disk | FTP | other *** search
/ PC World 2005 June / PCWorld_2005-06_cd.bin / software / vyzkuste / firewally / firewally.exe / framework-2.3.exe / spinner < prev    next >
Text File  |  2003-09-01  |  767b  |  29 lines

  1. # ----------------------------------------------------------------------
  2. #  DEMO: spinner in [incr Widgets]
  3. # ----------------------------------------------------------------------
  4. package require Iwidgets 4.0
  5.  
  6. option add *textBackground seashell
  7.  
  8. proc spinMonth {win step} {
  9.     set months {
  10.         January February March April
  11.         May June July August September
  12.         October November December
  13.     }
  14.  
  15.     set index [expr [lsearch $months [$win get]] + $step]
  16.  
  17.     if {$index < 0} {set index 11}
  18.     if {$index > 11} {set index 0}
  19.  
  20.     $win delete 0 end
  21.     $win insert 0 [lindex $months $index]
  22. }
  23.  
  24. iwidgets::spinner .sm -labeltext "Month:" -width 10 -fixed 10 \
  25.     -decrement {spinMonth .sm -1} -increment {spinMonth .sm 1}
  26.  
  27. pack .sm
  28. .sm insert 0 "January"
  29.