Tk Source Code

View Ticket
Login
2026-09-30
20:44 • Closed ticket [4e7fbe8b]: X11: menus taller than the screen cannot be scrolled plus 9 other changes artifact: f6dc1835 user: nemethi
20:31 • Closed ticket [680660ff]: Menu items accidentally selected plus 10 other changes artifact: ee74d092 user: nemethi
19:56
Fix for [470331ffff]: Displaced menus do not stay open; [680660ffff]: Menu items accidentally selected; [1596662fff]: Menu behaviour at screen bottom; [f9d316a5e0]: Linux menu problem if menu near the bottom of screen. check-in: 3aacabb1 user: csaba tags: core-8-6-branch
18:10
Fix for [470331ffff]: Displaced menus do not stay open; [680660ffff]: Menu items accidentally selected; [1596662fff]: Menu behaviour at screen bottom; [f9d316a5e0]: Linux menu problem if menu near the bottom of screen. check-in: 5c47ae3e user: csaba tags: core-9-0-branch
16:26
Fix for [470331ffff]: Displaced menus do not stay open; [680660ffff]: Menu items accidentally selected; [1596662fff]: Menu behaviour at screen bottom; [f9d316a5e0]: Linux menu problem if menu near the bottom of screen; [4e7fbe8b4a]: X11: menus taller than the screen cannot be scrolled. check-in: 0f866663 user: csaba tags: trunk, main
08:46 • Ticket [680660ff] Menu items accidentally selected status still Open with 4 other changes artifact: f32de081 user: serhiy.storchaka
08:44 • Ticket [470331ff] Displaced Menus do not stay open. status still Open with 4 other changes artifact: 2f1dc6a4 user: serhiy.storchaka
2026-09-29
20:40
Fix [470331], [680660], [1596662fff], [f9d316a5e0]: a menu posted over its menubutton or menubar entry invoked the entry under the pointer on the release of the click which posted it. Post the menu of a menubar entry or a menubutton above it if it does not fit below, or aside of the pointer if it fits neither below nor above. Ignore the release of the click which posted a menu if the pointer is over another menu and has not moved. check-in: c8129022 user: serhiy.storchaka tags: menu-post-under-pointer
2005-05-28
11:48 • Ticket [680660ff] Menu items accidentally selected status still Open with 4 other changes artifact: 71598956 user: djarseneau
11:48 • Add attachment menubug2.tcl to ticket [680660ff] artifact: 1febba8d user: djarseneau
11:48 • Ticket [680660ff] Menu items accidentally selected status still Open with 4 other changes artifact: 5d099d10 user: djarseneau
2005-05-27
05:29 • Ticket [680660ff]: 4 changes artifact: a8632a9f user: jenglish
2003-02-06
09:18 • Add attachment menubug.tcl to ticket [680660ff] artifact: 67d780b3 user: djarseneau
09:18 • Ticket [680660ff] Menu items accidentally selected status still Open with 4 other changes artifact: 70097951 user: djarseneau
2003-02-05
03:43 • New ticket [680660ff]. artifact: 20d1bafa user: djarseneau

Ticket UUID: 680660
Title: Menu items accidentally selected
Type: Bug Version: obsolete: 8.4.1, 8.6.18, 9.0.5, 9.1b1
Submitter: djarseneau Created on: 2003-02-05 03:43:08
Subsystem: 01. Bindings Assigned To: aku
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2026-09-30 20:31:45
Resolution: Fixed Closed By: nemethi
    Closed on: 2026-09-30 20:31:45
Description:
The bindings for menubuttons/menus allow mouse
selection by
either press-drag-release or by click-move-click, and
both
normally work fine.  However, when the menu is posted
so it
overlaps the menubutton, the click-move-click scheme
fails
because some random menu item receives the
ButtonRelease 
from the initial click on the menubutton, and gets
selected
immediately.

I have included a demo, if that is of any use.  Try
clicking on
the menu button with the window positioned mear the
bottom
of the computer screen.

This behavior occurs on Linux installations of Tcl 8.0
- 8.4.1
(at least).  I suspect the problem does not occur on
Windows.

I think the bindings for menus should not accept a
ButtonRelease 
for some short period after the menu is posted.  The
short period
is probably specified by the window manager settings as
the
button-click time.  

As a work-around, I have been using:

bind Menubutton <Button-1> {+
   bind [winfo children %W] <ButtonRelease-1> {break}
   after 300 { bind [winfo children %W]
<ButtonRelease-1> {}}
}

to disable the ButtonRelease event in menus for the
first 300ms
after the MenuButton is clicked on.
User Comments: nemethi (claiming to be Csaba Nemethi) added on 2026-09-30 20:31:45:

Serhiy, many thanks! The fix is now in main, core-9-0-branch, and core-8-6-branch; see commits [0f866663], [5c47ae3e], and [3aacabb1].


serhiy.storchaka added on 2026-09-30 08:46:22:

The same problem as [470331]. Proposed fix in branch menu-post-under-pointer: the release of the click which posted the menu over the menubutton is ignored while the pointer has not moved, for menubutton and ttk::menubutton. A menu which does not fit below the menubutton is posted above it, or beside the pointer. See [470331] for details.


djarseneau added on 2005-05-28 11:48:40:

File Added - 136286: menubug2.tcl

djarseneau added on 2005-05-28 11:48:39:
Logged In: YES 
user_id=611156

Indeed, the the change of '-direction' goes a long way to
relieving this problem.  It makes it much less likely for a
menu to overlay its menubutton and receive the end-of-click
ButtonRelease.

I've modified the test case by adding several dwarves to the
dwarfs menu.  Now it should fail when the window is in the
middle of the screen, but succeed when at the top or bottom
(but depending on the screen size).

I do feel that the overlap, by itself, is not wrong, even
though the bug can be fixed by either preventing overlap or
by delaying the bindings.  It is the blind acceptance of any
ButtonRelease, even when it is part of the initial short
'click' that is conceptually wrong.

jenglish added on 2005-05-27 05:29:17:
Logged In: YES 
user_id=68433

The attached test case appears to be out-of-date --
following the instructions in the label (move the window to
the bottom of the screen and click on the menubutton), in Tk
8.4.9 the menu is posted above the menubutton, not on top of
it.  (The menubutton in effect switches from '-direction
below' to '-direction above' if '-direction below' would
place the menu offscreen).

Don't know if the underlying problem is still present, but
the test case doesn't  seem to trigger it anymore.

djarseneau added on 2003-02-06 09:18:58:

File Added - 41628: menubug.tcl

Attachments: