Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: ae75e32a264e08de4b0a9678a8aea5d27c473cb0
Ticket: 469272ffffffffffffffffffffffffffffffffff
tk fails to grab if the workspace change
User & Date: gauravdj on 2001-10-08 20:33:36
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    On solaris 
    In case tcl takes somelong time to execute something 
    and you click on the menu and changes the workspace 
    before that execution is completed tcl fails
    
    the grab -global $menu 
           in tkMenuButtonDown fails
    
    try this use a.tcl 
    
    click on "file"
    click test
    click edit and then change the workspace 
    
    ***********************************************
    contents of a.tcl
    ***********************************************
    menu .m
    menu .file
    menu .edit
    
    .m add cascade -menu .file -label File
    .file add command -label "Test" -command longtime
    
    .m add cascade -menu .edit -label Edit
    .edit add command -label "Hello"
    
    . configure -menu .m
    
    proc longtime {} {
      after 5000
      puts "POSTED"
    }
    
    proc tkMenuButtonDown menu {
        global tkPriv
        global tcl_platform
    
        if {![winfo viewable $menu]} {
            return
        }
        $menu postcascade active
        if {[string compare $tkPriv(postedMb) ""] && \
        [winfo viewable $tkPriv(postedMb)]} {
    grab -global $tkPriv(postedMb)
        } else {
    while {[string equal [$menu cget -
    type] "normal"] \
    && [string equal [winfo class [winfo 
    parent $menu]] "Menu"] \
    && [winfo ismapped [winfo parent 
    $menu]]} {
        set menu [winfo parent $menu]
    }
    
    if {[string equal $tkPriv(menuBar) {}]} {
        set tkPriv(menuBar) $menu
        set tkPriv(cursor) [$menu cget -cursor]
        $menu configure -cursor arrow
            }
    
    # Don't update grab information if the grab 
    window isn't changing.
    # Otherwise, we'll get an error when we unpost 
    the menus and
    # restore the grab, since the old grab window 
    will not be viewable
    # anymore.
    
    if {[string compare $menu [grab current 
    $menu]]} {
        tkSaveGrabInfo $menu
    }
    
    # Must re-grab even if the grab window hasn't 
    changed, in order
    # to release the implicit grab from the button 
    press.
    
    if {[string equal $tcl_platform
    (platform) "unix"]} {
        puts "MAPPED [winfo ismapped $menu]"
        puts "VIEWABLE [winfo viewable $menu]"
        puts "STATE [wm state [winfo toplevel 
    $menu]]"
        grab -global $menu
    }
        }
    }
    
    
  4. foundin changed to: "obsolete: 8.3b2"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "gauravdj"
  9. subsystem changed to: "05. XT Notifier"
  10. title changed to: "tk fails to grab if the workspace change"
  11. type changed to: "Bug"