home *** CD-ROM | disk | FTP | other *** search
/ PC World 2002 May / PCWorld_2002-05_cd.bin / Software / TemaCD / activetcltk / ActiveTcl8.3.4.1-8.win32-ix86.exe / ActiveTcl8.3.4.1-win32-ix86 / lib / bwidget1.3.0 / arrow.tcl next >
Encoding:
Text File  |  2001-10-22  |  21.1 KB  |  562 lines

  1. # ------------------------------------------------------------------------------
  2. #  arrow.tcl
  3. #  This file is part of Unifix BWidget Toolkit
  4. # ------------------------------------------------------------------------------
  5. #  Index of commands:
  6. #   Public commands
  7. #     - ArrowButton::create
  8. #     - ArrowButton::configure
  9. #     - ArrowButton::cget
  10. #     - ArrowButton::invoke
  11. #   Private commands (redraw commands)
  12. #     - ArrowButton::_redraw
  13. #     - ArrowButton::_redraw_state
  14. #     - ArrowButton::_redraw_relief
  15. #     - ArrowButton::_redraw_whole
  16. #   Private commands (event bindings)
  17. #     - ArrowButton::_destroy
  18. #     - ArrowButton::_enter
  19. #     - ArrowButton::_leave
  20. #     - ArrowButton::_press
  21. #     - ArrowButton::_release
  22. #     - ArrowButton::_repeat
  23. # ------------------------------------------------------------------------------
  24.  
  25. namespace eval ArrowButton {
  26.  
  27.     Widget::tkinclude ArrowButton button .c \
  28.         include [list \
  29.         -borderwidth -bd \
  30.         -relief -highlightbackground \
  31.         -highlightcolor -highlightthickness -takefocus]
  32.  
  33.     Widget::declare ArrowButton [list \
  34.         [list -type        Enum button 0 [list arrow button]] \
  35.         [list -dir        Enum top    0 [list top bottom left right]] \
  36.         [list -width    Int    15    0    "%d >= 0"] \
  37.         [list -height    Int    15    0    "%d >= 0"] \
  38.         [list -ipadx    Int    0    0    "%d >= 0"] \
  39.         [list -ipady    Int    0    0    "%d >= 0"] \
  40.         [list -clean    Int    2    0    "%d >= 0 && %d <= 2"] \
  41.         [list -activeforeground    TkResource    ""    0 button] \
  42.         [list -activebackground    TkResource    ""    0 button] \
  43.         [list -disabledforeground     TkResource    ""    0 button] \
  44.         [list -foreground        TkResource    ""    0 button] \
  45.         [list -background        TkResource    ""    0 button] \
  46.         [list -state        TkResource    ""    0 button] \
  47.         [list -troughcolor        TkResource    ""    0 scrollbar] \
  48.         [list -arrowbd    Int    1    0    "%d >= 0 && %d <= 2"] \
  49.         [list -arrowrelief    Enum    raised    0    [list raised sunken]] \
  50.         [list -command        String    ""    0] \
  51.         [list -armcommand        String    ""    0] \
  52.         [list -disarmcommand    String    ""    0] \
  53.         [list -repeatdelay        Int    0    0    "%d >= 0"] \
  54.         [list -repeatinterval    Int    0    0    "%d >= 0"] \
  55.         [list -fg    Synonym    -foreground] \
  56.         [list -bg    Synonym    -background] \
  57.         ]
  58.     DynamicHelp::include ArrowButton balloon
  59.  
  60.     proc ::ArrowButton { path args } { return [eval ArrowButton::create $path $args] }
  61.  
  62.     proc use {} {}
  63.  
  64.     bind BwArrowButtonC <Enter>           {ArrowButton::_enter %W}
  65.     bind BwArrowButtonC <Leave>           {ArrowButton::_leave %W}
  66.     bind BwArrowButtonC <ButtonPress-1>   {ArrowButton::_press %W}
  67.     bind BwArrowButtonC <ButtonRelease-1> {ArrowButton::_release %W}
  68.     bind BwArrowButtonC <Key-space>       {ArrowButton::invoke %W; break}
  69.     bind BwArrowButtonC <Return>          {ArrowButton::invoke %W; break}
  70.     bind BwArrowButton <Configure>       {ArrowButton::_redraw_whole %W %w %h}
  71.     bind BwArrowButton <Destroy>         {ArrowButton::_destroy %W}
  72.  
  73.     variable _grab
  74.     variable _moved
  75.  
  76.     array set _grab {current "" pressed "" oldstate "" oldrelief ""}
  77. }
  78.  
  79.  
  80. # -----------------------------------------------------------------------------
  81. #  Command ArrowButton::create
  82. # -----------------------------------------------------------------------------
  83. proc ArrowButton::create { path args } {
  84.     # Initialize configuration mappings and parse arguments
  85.     array set submaps [list ArrowButton [list ] .c [list ]]
  86.     array set submaps [Widget::parseArgs ArrowButton $args]
  87.  
  88.     # Create the class frame (so we can do the option db queries)
  89.     frame $path -class ArrowButton -borderwidth 0 -highlightthickness 0 
  90.     Widget::initFromODB ArrowButton $path $submaps(ArrowButton)
  91.  
  92.     # Create the canvas with the initial options
  93.     eval canvas $path.c $submaps(.c)
  94.  
  95.     # Compute the width and height of the canvas from the width/height
  96.     # of the ArrowButton and the borderwidth/hightlightthickness.
  97.     set w   [Widget::getMegawidgetOption $path -width]
  98.     set h   [Widget::getMegawidgetOption $path -height]
  99.     set bd  [Widget::cget $path -borderwidth]
  100.     set ht  [Widget::cget $path -highlightthickness]
  101.     set pad [expr {2*($bd+$ht)}]
  102.  
  103.     $path.c configure -width [expr {$w-$pad}] -height [expr {$h-$pad}]
  104.     bindtags $path [list $path BwArrowButton [winfo toplevel $path] all]
  105.     bindtags $path.c [list $path.c BwArrowButtonC [winfo toplevel $path.c] all]
  106.     pack $path.c -expand yes -fill both
  107.  
  108.     DynamicHelp::sethelp $path $path.c 1
  109.  
  110.     set ::ArrowButton::_moved($path) 0
  111.  
  112.     rename $path ::$path:cmd
  113.     proc ::$path { cmd args } "return \[eval ArrowButton::\$cmd $path \$args\]"
  114.  
  115.     return $path
  116. }
  117.  
  118.  
  119. # -----------------------------------------------------------------------------
  120. #  Command ArrowButton::configure
  121. # -----------------------------------------------------------------------------
  122. proc ArrowButton::configure { path args } {
  123.     set res [Widget::configure $path $args]
  124.  
  125.     set ch1 [expr {[Widget::hasChanged $path -width  w] |
  126.                    [Widget::hasChanged $path -height h] |
  127.                    [Widget::hasChanged $path -borderwidth bd] |
  128.                    [Widget::hasChanged $path -highlightthickness ht]}]
  129.     set ch2 [expr {[Widget::hasChanged $path -type    val] |
  130.                    [Widget::hasChanged $path -ipadx   val] |
  131.                    [Widget::hasChanged $path -ipady   val] |
  132.                    [Widget::hasChanged $path -arrowbd val] |
  133.                    [Widget::hasChanged $path -clean   val] |
  134.                    [Widget::hasChanged $path -dir     val]}]
  135.  
  136.     if { $ch1 } {
  137.         set pad [expr {2*($bd+$ht)}]
  138.         $path.c configure \
  139.             -width [expr {$w-$pad}] -height [expr {$h-$pad}] \
  140.             -borderwidth $bd -highlightthickness $ht
  141.     set ch2 1
  142.     }
  143.     if { $ch2 } {
  144.         _redraw_whole $path [winfo width $path] [winfo height $path]
  145.     } else {
  146.         _redraw_relief $path
  147.         _redraw_state $path
  148.     }
  149.     DynamicHelp::sethelp $path $path.c
  150.  
  151.     return $res
  152. }
  153.  
  154.  
  155. # -----------------------------------------------------------------------------
  156. #  Command ArrowButton::cget
  157. # -----------------------------------------------------------------------------
  158. proc ArrowButton::cget { path option } {
  159.     return [Widget::cget $path $option]
  160. }
  161.  
  162.  
  163. # ------------------------------------------------------------------------------
  164. #  Command ArrowButton::invoke
  165. # ------------------------------------------------------------------------------
  166. proc ArrowButton::invoke { path } {
  167.     if { ![string equal [winfo class $path] "ArrowButton"] } {
  168.     set path [winfo parent $path]
  169.     }
  170.     if { [string compare [Widget::getoption $path -state] "disabled"] } {
  171.         set oldstate [Widget::getoption $path -state]
  172.         if { ![string compare [Widget::getoption $path -type] "button"] } {
  173.             set oldrelief [Widget::getoption $path -relief]
  174.             configure $path -state active -relief sunken
  175.         } else {
  176.             set oldrelief [Widget::getoption $path -arrowrelief]
  177.             configure $path -state active -arrowrelief sunken
  178.         }
  179.     update idletasks
  180.         if { [set cmd [Widget::getoption $path -armcommand]] != "" } {
  181.             uplevel \#0 $cmd
  182.         }
  183.     after 10
  184.         if { ![string compare [Widget::getoption $path -type] "button"] } {
  185.             configure $path -state $oldstate -relief $oldrelief
  186.         } else {
  187.             configure $path -state $oldstate -arrowrelief $oldrelief
  188.         }
  189.         if { [set cmd [Widget::getoption $path -disarmcommand]] != "" } {
  190.             uplevel \#0 $cmd
  191.         }
  192.         if { [set cmd [Widget::getoption $path -command]] != "" } {
  193.             uplevel \#0 $cmd
  194.         }
  195.     }
  196. }
  197.  
  198.  
  199. # ------------------------------------------------------------------------------
  200. #  Command ArrowButton::_redraw
  201. # ------------------------------------------------------------------------------
  202. proc ArrowButton::_redraw { path width height } {
  203.     variable _moved
  204.  
  205.     set _moved($path) 0
  206.     set type  [Widget::getoption $path -type]
  207.     set dir   [Widget::getoption $path -dir]
  208.     set bd    [expr {[$path.c cget -borderwidth] + [$path.c cget -highlightthickness] + 1}]
  209.     set clean [Widget::getoption $path -clean]
  210.     if { ![string compare $type "arrow"] } {
  211.         if { [set id [$path.c find withtag rect]] == "" } {
  212.             $path.c create rectangle $bd $bd [expr {$width-$bd-1}] [expr {$height-$bd-1}] -tags rect
  213.         } else {
  214.             $path.c coords $id $bd $bd [expr {$width-$bd-1}] [expr {$height-$bd-1}]
  215.         }
  216.         $path.c lower rect
  217.         set arrbd [Widget::getoption $path -arrowbd]
  218.         set bd    [expr {$bd+$arrbd-1}]
  219.     } else {
  220.         $path.c delete rect
  221.     }
  222.     # w and h are max width and max height of arrow
  223.     set w [expr {$width  - 2*([Widget::getoption $path -ipadx]+$bd)}]
  224.     set h [expr {$height - 2*([Widget::getoption $path -ipady]+$bd)}]
  225.  
  226.     if { $w < 2 } {set w 2}
  227.     if { $h < 2 } {set h 2}
  228.  
  229.     if { $clean > 0 } {
  230.         # arrange for base to be odd
  231.         if { ![string compare $dir "top"] ||
  232.              ![string compare $dir "bottom"] } {
  233.             if { !($w % 2) } {
  234.                 incr w -1
  235.             }
  236.             if { $clean == 2 } {
  237.                 # arrange for h = (w+1)/2
  238.                 set h2 [expr {($w+1)/2}]
  239.                 if { $h2 > $h } {
  240.                     set w [expr {2*$h-1}]
  241.                 } else {
  242.                     set h $h2
  243.                 }
  244.             }
  245.         } else {
  246.             if { !($h % 2) } {
  247.                 incr h -1
  248.             }
  249.             if { $clean == 2 } {
  250.                 # arrange for w = (h+1)/2
  251.                 set w2 [expr {($h+1)/2}]
  252.                 if { $w2 > $w } {
  253.                     set h [expr {2*$w-1}]
  254.                 } else {
  255.                     set w $w2
  256.                 }
  257.             }
  258.         }
  259.     }
  260.  
  261.     set x0 [expr {($width-$w)/2}]
  262.     set y0 [expr {($height-$h)/2}]
  263.     set x1 [expr {$x0+$w-1}]
  264.     set y1 [expr {$y0+$h-1}]
  265.  
  266.     switch $dir {
  267.         top {
  268.             set xd [expr {($x0+$x1)/2}]
  269.             if { [set id [$path.c find withtag poly]] == "" } {
  270.                 $path.c create polygon $x0 $y1 $x1 $y1 $xd $y0 -tags poly
  271.             } else {
  272.                 $path.c coords $id $x0 $y1 $x1 $y1 $xd $y0
  273.             }
  274.             if { ![string compare $type "arrow"] } {
  275.                 if { [set id [$path.c find withtag bot]] == "" } {
  276.                     $path.c create line $x0 $y1 $x1 $y1 $xd $y0 -tags bot
  277.                 } else {
  278.                     $path.c coords $id $x0 $y1 $x1 $y1 $xd $y0
  279.                 }
  280.                 if { [set id [$path.c find withtag top]] == "" } {
  281.                     $path.c create line $x0 $y1 $xd $y0 -tags top
  282.                 } else {
  283.                     $path.c coords $id $x0 $y1 $xd $y0
  284.                 }
  285.                 $path.c itemconfigure top -width $arrbd
  286.                 $path.c itemconfigure bot -width $arrbd
  287.             } else {
  288.                 $path.c delete top
  289.                 $path.c delete bot
  290.             }
  291.         }
  292.         bottom {
  293.             set xd [expr {($x0+$x1)/2}]
  294.             if { [set id [$path.c find withtag poly]] == "" } {
  295.                 $path.c create polygon $x1 $y0 $x0 $y0 $xd $y1 -tags poly
  296.             } else {
  297.                 $path.c coords $id $x1 $y0 $x0 $y0 $xd $y1
  298.             }
  299.             if { ![string compare $type "arrow"] } {
  300.                 if { [set id [$path.c find withtag top]] == "" } {
  301.                     $path.c create line $x1 $y0 $x0 $y0 $xd $y1 -tags top
  302.                 } else {
  303.                     $path.c coords $id $x1 $y0 $x0 $y0 $xd $y1
  304.                 }
  305.                 if { [set id [$path.c find withtag bot]] == "" } {
  306.                     $path.c create line $x1 $y0 $xd $y1 -tags bot
  307.                 } else {
  308.                     $path.c coords $id $x1 $y0 $xd $y1
  309.                 }
  310.                 $path.c itemconfigure top -width $arrbd
  311.                 $path.c itemconfigure bot -width $arrbd
  312.             } else {
  313.                 $path.c delete top
  314.                 $path.c delete bot
  315.             }
  316.         }
  317.         left {
  318.             set yd [expr {($y0+$y1)/2}]
  319.             if { [set id [$path.c find withtag poly]] == "" } {
  320.                 $path.c create polygon $x1 $y0 $x1 $y1 $x0 $yd -tags poly
  321.             } else {
  322.                 $path.c coords $id $x1 $y0 $x1 $y1 $x0 $yd
  323.             }
  324.             if { ![string compare $type "arrow"] } {
  325.                 if { [set id [$path.c find withtag bot]] == "" } {
  326.                     $path.c create line $x1 $y0 $x1 $y1 $x0 $yd -tags bot
  327.                 } else {
  328.                     $path.c coords $id $x1 $y0 $x1 $y1 $x0 $yd
  329.                 }
  330.                 if { [set id [$path.c find withtag top]] == "" } {
  331.                     $path.c create line $x1 $y0 $x0 $yd -tags top
  332.                 } else {
  333.                     $path.c coords $id $x1 $y0 $x0 $yd
  334.                 }
  335.                 $path.c itemconfigure top -width $arrbd
  336.                 $path.c itemconfigure bot -width $arrbd
  337.             } else {
  338.                 $path.c delete top
  339.                 $path.c delete bot
  340.             }
  341.         }
  342.         right {
  343.             set yd [expr {($y0+$y1)/2}]
  344.             if { [set id [$path.c find withtag poly]] == "" } {
  345.                 $path.c create polygon $x0 $y1 $x0 $y0 $x1 $yd -tags poly
  346.             } else {
  347.                 $path.c coords $id $x0 $y1 $x0 $y0 $x1 $yd
  348.             }
  349.             if { ![string compare $type "arrow"] } {
  350.                 if { [set id [$path.c find withtag top]] == "" } {
  351.                     $path.c create line $x0 $y1 $x0 $y0 $x1 $yd -tags top
  352.                 } else {
  353.                     $path.c coords $id $x0 $y1 $x0 $y0 $x1 $yd
  354.                 }
  355.                 if { [set id [$path.c find withtag bot]] == "" } {
  356.                     $path.c create line $x0 $y1 $x1 $yd -tags bot
  357.                 } else {
  358.                     $path.c coords $id $x0 $y1 $x1 $yd
  359.                 }
  360.                 $path.c itemconfigure top -width $arrbd
  361.                 $path.c itemconfigure bot -width $arrbd
  362.             } else {
  363.                 $path.c delete top
  364.                 $path.c delete bot
  365.             }
  366.         }
  367.     }
  368. }
  369.  
  370.  
  371. # ------------------------------------------------------------------------------
  372. #  Command ArrowButton::_redraw_state
  373. # ------------------------------------------------------------------------------
  374. proc ArrowButton::_redraw_state { path } {
  375.     set state [Widget::getoption $path -state]
  376.     if { ![string compare [Widget::getoption $path -type] "button"] } {
  377.         switch $state {
  378.             normal   {set bg -background;       set fg -foreground}
  379.             active   {set bg -activebackground; set fg -activeforeground}
  380.             disabled {set bg -background;       set fg -disabledforeground}
  381.         }
  382.         set fg [Widget::getoption $path $fg]
  383.         $path.c configure -background [Widget::getoption $path $bg]
  384.         $path.c itemconfigure poly -fill $fg -outline $fg
  385.     } else {
  386.         switch $state {
  387.             normal   {set stipple "";     set bg [Widget::getoption $path -background] }
  388.             active   {set stipple "";     set bg [Widget::getoption $path -activebackground] }
  389.             disabled {set stipple gray50; set bg black }
  390.         }
  391.         set thrc [Widget::getoption $path -troughcolor]
  392.         $path.c configure -background [Widget::getoption $path -background]
  393.         $path.c itemconfigure rect -fill $thrc -outline $thrc
  394.         $path.c itemconfigure poly -fill $bg   -outline $bg -stipple $stipple
  395.     }
  396. }
  397.  
  398.  
  399. # ------------------------------------------------------------------------------
  400. #  Command ArrowButton::_redraw_relief
  401. # ------------------------------------------------------------------------------
  402. proc ArrowButton::_redraw_relief { path } {
  403.     variable _moved
  404.  
  405.     if { ![string compare [Widget::getoption $path -type] "button"] } {
  406.         if { ![string compare [Widget::getoption $path -relief] "sunken"] } {
  407.             if { !$_moved($path) } {
  408.                 $path.c move poly 1 1
  409.                 set _moved($path) 1
  410.             }
  411.         } else {
  412.             if { $_moved($path) } {
  413.                 $path.c move poly -1 -1
  414.                 set _moved($path) 0
  415.             }
  416.         }
  417.     } else {
  418.         set col3d [BWidget::get3dcolor $path [Widget::getoption $path -background]]
  419.         switch [Widget::getoption $path -arrowrelief] {
  420.             raised {set top [lindex $col3d 1]; set bot [lindex $col3d 0]}
  421.             sunken {set top [lindex $col3d 0]; set bot [lindex $col3d 1]}
  422.         }
  423.         $path.c itemconfigure top -fill $top
  424.         $path.c itemconfigure bot -fill $bot
  425.     }
  426. }
  427.  
  428.  
  429. # ------------------------------------------------------------------------------
  430. #  Command ArrowButton::_redraw_whole
  431. # ------------------------------------------------------------------------------
  432. proc ArrowButton::_redraw_whole { path width height } {
  433.     _redraw $path $width $height
  434.     _redraw_relief $path
  435.     _redraw_state $path
  436. }
  437.  
  438.  
  439. # ------------------------------------------------------------------------------
  440. #  Command ArrowButton::_destroy
  441. # ------------------------------------------------------------------------------
  442. proc ArrowButton::_destroy { path } {
  443.     variable _moved
  444.  
  445.     Widget::destroy $path
  446.     unset _moved($path)
  447.     rename $path {}
  448. }
  449.  
  450.  
  451. # ------------------------------------------------------------------------------
  452. #  Command ArrowButton::_enter
  453. # ------------------------------------------------------------------------------
  454. proc ArrowButton::_enter { path } {
  455.     variable _grab
  456.     set path [winfo parent $path]
  457.     set _grab(current) $path
  458.     if { [string compare [Widget::getoption $path -state] "disabled"] } {
  459.         set _grab(oldstate) [Widget::getoption $path -state]
  460.         configure $path -state active
  461.         if { $_grab(pressed) == $path } {
  462.             if { ![string compare [Widget::getoption $path -type] "button"] } {
  463.                 set _grab(oldrelief) [Widget::getoption $path -relief]
  464.                 configure $path -relief sunken
  465.             } else {
  466.                 set _grab(oldrelief) [Widget::getoption $path -arrowrelief]
  467.                 configure $path -arrowrelief sunken
  468.             }
  469.         }
  470.     }
  471. }
  472.  
  473.  
  474. # ------------------------------------------------------------------------------
  475. #  Command ArrowButton::_leave
  476. # ------------------------------------------------------------------------------
  477. proc ArrowButton::_leave { path } {
  478.     variable _grab
  479.     set path [winfo parent $path]
  480.     set _grab(current) ""
  481.     if { [string compare [Widget::getoption $path -state] "disabled"] } {
  482.         configure $path -state $_grab(oldstate)
  483.         if { $_grab(pressed) == $path } {
  484.             if { ![string compare [Widget::getoption $path -type] "button"] } {
  485.                 configure $path -relief $_grab(oldrelief)
  486.             } else {
  487.                 configure $path -arrowrelief $_grab(oldrelief)
  488.             }
  489.         }
  490.     }
  491. }
  492.  
  493.  
  494. # ------------------------------------------------------------------------------
  495. #  Command ArrowButton::_press
  496. # ------------------------------------------------------------------------------
  497. proc ArrowButton::_press { path } {
  498.     variable _grab
  499.     set path [winfo parent $path]
  500.     if { [string compare [Widget::getoption $path -state] "disabled"] } {
  501.         set _grab(pressed) $path
  502.             if { ![string compare [Widget::getoption $path -type] "button"] } {
  503.             set _grab(oldrelief) [Widget::getoption $path -relief]
  504.             configure $path -relief sunken
  505.         } else {
  506.             set _grab(oldrelief) [Widget::getoption $path -arrowrelief]
  507.             configure $path -arrowrelief sunken
  508.         }
  509.         if { [set cmd [Widget::getoption $path -armcommand]] != "" } {
  510.             uplevel \#0 $cmd
  511.             if { [set delay [Widget::getoption $path -repeatdelay]]    > 0 ||
  512.                  [set delay [Widget::getoption $path -repeatinterval]] > 0 } {
  513.                 after $delay "ArrowButton::_repeat $path"
  514.             }
  515.         }
  516.     }
  517. }
  518.  
  519.  
  520. # ------------------------------------------------------------------------------
  521. #  Command ArrowButton::_release
  522. # ------------------------------------------------------------------------------
  523. proc ArrowButton::_release { path } {
  524.     variable _grab
  525.     set path [winfo parent $path]
  526.     if { $_grab(pressed) == $path } {
  527.         set _grab(pressed) ""
  528.             if { ![string compare [Widget::getoption $path -type] "button"] } {
  529.             configure $path -relief $_grab(oldrelief)
  530.         } else {
  531.             configure $path -arrowrelief $_grab(oldrelief)
  532.         }
  533.         if { [set cmd [Widget::getoption $path -disarmcommand]] != "" } {
  534.             uplevel \#0 $cmd
  535.         }
  536.         if { $_grab(current) == $path &&
  537.              [string compare [Widget::getoption $path -state] "disabled"] &&
  538.              [set cmd [Widget::getoption $path -command]] != "" } {
  539.             uplevel \#0 $cmd
  540.         }
  541.     }
  542. }
  543.  
  544.  
  545. # ------------------------------------------------------------------------------
  546. #  Command ArrowButton::_repeat
  547. # ------------------------------------------------------------------------------
  548. proc ArrowButton::_repeat { path } {
  549.     variable _grab
  550.     if { $_grab(current) == $path && $_grab(pressed) == $path &&
  551.          [string compare [Widget::getoption $path -state] "disabled"] &&
  552.          [set cmd [Widget::getoption $path -armcommand]] != "" } {
  553.         uplevel \#0 $cmd
  554.     }
  555.     if { $_grab(pressed) == $path &&
  556.          ([set delay [Widget::getoption $path -repeatinterval]] > 0 ||
  557.           [set delay [Widget::getoption $path -repeatdelay]]    > 0) } {
  558.         after $delay "ArrowButton::_repeat $path"
  559.     }
  560. }
  561.  
  562.