| Ticket UUID: | 680884 | |||
| Title: | menubutton scripts are confused about their owning menu | |||
| Type: | Bug | Version: | 8.5a0, 8.6.18, 9.0.5, 9.1b1 | |
| Submitter: | vincentdarley | Created on: | 2003-02-05 13:43:28 | |
| Subsystem: | 10. Generic Menus | Assigned To: | aku | |
| Priority: | 5 Medium | Severity: | Minor | |
| Status: | Closed | Last Modified: | 2026-10-13 11:49:44 | |
| Resolution: | Fixed | Closed By: | nemethi | |
| Closed on: | 2026-10-13 11:49:44 | |||
| Description: |
The attached script shows a bug in the menubutton scripts, when the act of creating a menu takes some time, and the user inadvertently moves the mouse onto a different menu button. Tk tries to *post* the menu for the other menubutton, but that doesn't exist! Given we are in the middle of executing bindings for the first button, there is no reason for Tk to try to do something on the other. # Now click on menu 'one', but while you # are waiting for it to popup, move the # mouse over menu 'two'. # # You will get the following bgerror: # # invalid command name ".two.m" # while executing # "$menu cget -type" # (procedure "MbPost" line 13) # invoked from within # "MbPost $new $rootx $rooty" # (procedure "tk::MbMotion" line 14) # invoked from within # "tk::MbMotion .one down 95 93 # " # (command bound to event) | |||
| User Comments: |
nemethi (claiming to be Csaba Nemethi) added on 2026-10-13 11:49:44:
Serhiy, many thanks for fixing this very long-standing bug! Merged into main, core-9.0-branch, and core-8-6-branch by commits [7dc6185f], [471d607b], and [81890c07]. serhiy.storchaka added on 2026-09-21 20:13:50: Still present in 8.6 and 9.1: a click on a menubutton whose menu does not exist yet raises "invalid command name" and "bad window path name" errors, and with the attached script the pointer motion to the other menubutton during the binding script posts the menu of that one (an error if it does not exist yet). The scenario of the script (an event loop in a <Button-1> binding of the menubutton) is quite uncommon; the usual way to create the menu on demand is -postcommand. I am not sure that it is worth even such a simple fix. Anyway, it is on branch menubutton-motion-unposted in [ef1ac0348f]: tk::MbPost does nothing if the menu does not exist, like the widget itself, and the pointer motion to another menubutton is ignored unless a menu is posted. tmh added on 2003-09-03 02:52:02: Logged In: YES user_id=92123 I have confirmed this bug in 8.4, Interestingly 8.5a0 has a different (still buggy) behavior, which I will attempt to describe. First click on menu 'one' then move the mouse over menu 'two'. Instead of the bgerror of invalid command, menu 'two' will post a menu instead of menu 'one'. It appears that a race condition is introduced by multiple bindings. vincentdarley added on 2003-02-06 17:52:41: Logged In: YES user_id=32170 NB. Even if I try to workaround the problem, by putting a 'grab' on the menu while the long process is taking place, then the error moves to, say, the button-up binding on the other menubutton. vincentdarley added on 2003-02-05 21:37:22: File Added - 41578: menuButtonTest.tcl Logged In: YES user_id=32170 Attaching file -- why doesn't sourceforge ever do this on first try? | |||
Attachments:
- menuButtonTest.tcl [download] added by vincentdarley on 2003-02-05 21:37:22. [details]
