Tk Source Code

Ticket Change Details
Login
Overview

Artifact ID: 864d586caf13a155194086e93a965eba2c2482bf
Ticket: 1581435fffffffffffffffffffffffffffffffff
menu index wrong if label is an integer
User & Date: fvogel 2015-09-02 20:32:45
Changes

  1. assignee changed to: "fvogel"
  2. closer changed to: "nobody"
  3. comment changed to:
    If a menu contains an item whose label is an integer,
    then menu index returns the value of that menu item,
    or if the integer is too large, then it returns
    the index of the last item in the menu.
    
    Here is a procedure to see this.
    Enter it into wish and select menu items to see the index.
    The index of entry "3" is reported as 3, but should be 1.
    
    menubutton .mb -m .mb.menu -text testmenu
    pack .mb
    set m [menu .mb.menu]
    $m add command -label foo -command {puts "foo: [$m index foo]"}
    $m add command -label 3 -command {puts "3: [$m index 3]"}
    $m add command -label 3a -command {puts "3: [$m index 3a]"}
    $m add command -label bar -command {puts "bar: [$m index bar]"}
    $m add command -label baz -command {puts "baz: [$m index baz]"}
    
    I saw this on ActiveState Aqua Tcl/Tk 8.4.13 on MacOS X 10.4.7. I have 
    not tried to duplicate it on other operating systems nor with 8.4.14 
    (since the ActiveState version is not yet available).
    
  4. icomment:
    Proposal for a fix in the documentation in branch bug-1581435fff
    
    A test case has also been augmented to check the precedence order in the matching process of the index string.
    
  5. login: "fvogel"
  6. mimetype: "text/plain"
  7. priority changed to: "6"
  8. resolution changed to: "Fixed"
  9. severity changed to: "Minor"