summaryrefslogtreecommitdiff
path: root/itcl/iwidgets3.0.0/generic/optionmenu.itk
diff options
context:
space:
mode:
authorIan Roxborough <irox@redhat.com>2001-09-09 19:49:03 +0000
committerIan Roxborough <irox@redhat.com>2001-09-09 19:49:03 +0000
commit57e8350a3895a1579b77cc134d6d7d49b056678e (patch)
tree7584c16f5407dd1371b8290109b3b822067afd5a /itcl/iwidgets3.0.0/generic/optionmenu.itk
parent7467241ff2a5cd6da7bbecb7111fc0dc3211c7de (diff)
downloadgdb-57e8350a3895a1579b77cc134d6d7d49b056678e.tar.gz
Itcl import for Tcl/Tk8.3 upgradeITCL_TCL_8_3
Diffstat (limited to 'itcl/iwidgets3.0.0/generic/optionmenu.itk')
-rw-r--r--itcl/iwidgets3.0.0/generic/optionmenu.itk24
1 files changed, 22 insertions, 2 deletions
diff --git a/itcl/iwidgets3.0.0/generic/optionmenu.itk b/itcl/iwidgets3.0.0/generic/optionmenu.itk
index cfc700f3033..f0fd8b998cd 100644
--- a/itcl/iwidgets3.0.0/generic/optionmenu.itk
+++ b/itcl/iwidgets3.0.0/generic/optionmenu.itk
@@ -123,7 +123,7 @@ body iwidgets::Optionmenu::constructor {args} {
component hull configure -highlightthickness 0
itk_component add menuBtn {
- menubutton $itk_interior.menuBtn -relief raised -indicator on \
+ menubutton $itk_interior.menuBtn -relief raised -indicatoron on \
-textvariable [scope _currentItem] -takefocus 1 \
-menu $itk_interior.menuBtn.menu
} {
@@ -411,6 +411,9 @@ body iwidgets::Optionmenu::insert {index string args} {
# ------------------------------------------------------------------
body iwidgets::Optionmenu::select {index} {
set index [index $index]
+ if {$index > [expr $_numitems - 1]} {
+ incr index -1
+ }
_setItem [lindex $_items $index]
}
@@ -601,7 +604,24 @@ body iwidgets::Optionmenu::_setitems {items_} {
#
if {$first != ""} {
set i [lsearch -exact $_items $savedCurrentItem]
- select [expr {$i != -1 ? $savedCurrentItem : $first}]
+ #-------------------------------------------------------------
+ # BEGIN BUG FIX: csmith (Chad Smith: csmith@adc.com), 11/18/99
+ #-------------------------------------------------------------
+ # The previous code fragment:
+ # <select [expr {$i != -1 ? $savedCurrentItem : $first}]>
+ # is faulty because of exponential numbers. For example,
+ # 2e-4 is numerically equal to 2e-04, but the string representation
+ # is of course different. As a result, the select invocation
+ # fails, and an error message is printed.
+ #-------------------------------------------------------------
+ if {$i != -1} {
+ select $savedCurrentItem
+ } else {
+ select $first
+ }
+ #-------------------------------------------------------------
+ # END BUG FIX
+ #-------------------------------------------------------------
} else {
_setItem ""
}