Tk Source Code

View Ticket
Login
Ticket UUID: 911951
Title: Menu geometry info wrong if cascaded
Type: Bug Version: obsolete: 8.5a1
Submitter: jaspert Created on: 2004-03-08 13:29:00
Subsystem: 10. Generic Menus Assigned To: aku
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2026-10-22 15:49:59
Resolution: Fixed Closed By: nemethi
    Closed on: 2026-10-22 15:49:59
Description:
If you post a menu directly with the post widget
command, or associate it with a menubutton and click on
that to post it, you can get info about its position
using the wm or winfo commands. However if you display
it by clicking on a cascade entry in another menu, this
information is wrong. The geometry comes up as 0x0+1+1
if it is displayed for the first time, or whatever it
was when it was last invoked directly or from a menubutton.

Tested on TclTk 8.4.2 with red hat linux 7.3
and 8.4.3, 8.4.6, and 8.5a1 with red hat linux 9
User Comments: nemethi (claiming to be Csaba Nemethi) added on 2026-10-22 15:49:59:

Serhiy, many thanks! Merged into main, core-9-0-branch, and core-8-6-branch by commits [51a8eab8], [21db2d8e], and [1bba1531].


serhiy.storchaka added on 2026-09-22 19:15:17:

This is not a geometry bug. A menu which is used as a menubar or is torn off is not posted itself: its clone is posted, and on Windows and macOS the menus are drawn by the system, so no Tk window is mapped at all. The original menu therefore keeps 1x1+0+0, or whatever it had when it was last posted directly, exactly as described here. On X11 the posted clone does report the right geometry.

The manual does not say which menu is posted. Branch doc-menu-clone-geometry ([1742a9e88c]) proposes documenting it.


dkf added on 2004-03-08 20:53:44:
Logged In: YES 
user_id=79902

FWIW, the problem here stems from the fact that cascade
menus are actually (IIRC) using clones of the menu, and not
the menu itself.  Usually the difference between a menu and
its clones is concealed, but this is obviously a spot where
it is not hidden.