Tk Source Code

View Ticket
Login
Ticket UUID: 220876
Title: Error with torn off menus
Type: Bug Version: obsolete: 8.2.1
Submitter: welch Created on: 2000-11-01 01:32:23
Subsystem: 10. Generic Menus Assigned To: pspjuth
Priority: 5 Medium Severity:
Status: Pending Last Modified: 2026-09-21 18:58:01
Resolution: Out of Date Closed By:
    Closed on:
Description:
OriginalBugID: 3408 Bug
Version: 8.2.1
SubmitDate: '1999-11-05'
LastModified: '1999-11-12'
Severity: LOW
Status: UnAssn
Submitter: techsupp
ChangedBy: hobbs
OS: Windows NT


Name:
Peter Spjuth

ReproducibleScript:
catch {console show}
    
    menubutton .mb -text Menu -menu .mb.m
    menu .mb.m
    .mb.m add command -label Apa
    .mb.m add cascade -label Bepa -menu .mb.m.m
    menu .mb.m.m
    .mb.m.m add command -label Cepa
    
    pack .mb
    
    proc apa {name1 name2 op} {
        set caller [lindex [info level -1] 0]
        puts "tkPriv(menuBar) is now \"$::tkPriv(menuBar)\" set in $caller"
    }
    trace variable tkPriv(menuBar) w apa
    
    ----------------
    Press the menu button and tear off the menu.
    In the torn off menu, click Bepa to open the cascade
    Click Cepa.
    The trace output should now show that tkPriv(menuBar) is ".tearoff1"
    Close the window with the torn off menu.
    Click the menu button.
    This gives an error since tkPriv(menuBar) references a window that does
    not exist.
    
    I have also seen another effect with torn off menus which might be
    related.
    Tear of the menu.
    Click Bepa to open the cascade.
    Click Cepa. The cascade disappears (as it should).
    Click Bepa. Nothing happens!
    Click Apa.
    Click Bepa. Now it works ok.
User Comments: serhiy.storchaka added on 2026-09-21 18:58:01:

I cannot reproduce this with 8.6.18 and 9.1 on X11 and Windows 11 (the script was run with real pointer clicks): in the torn-off menu the cascade opens again after an entry of it was invoked, and clicking the menubutton after closing the torn-off menu works, also with tk_strictMotif. The unconditional "configure -cursor" on tk::Priv(menuBar) which raised the error is behind tk_strictMotif since [7e8e231b0d] (8.5.4).


nobody added on 2001-11-08 23:37:47:
Logged In: NO 

What I have found, is that the only consistent way to get 
the menu to appear, I have to click and hold (over Bepa), 
move off and back onto the menu (still holding left down) 
so that the word Bepa becomes unhilighted and rehighlighted 
and then the menu item popup will appear again (along with 
the re-highlight of Bepa). One suggestion was that this 
might be a focus problem.