| Ticket UUID: | 1347712 | |||
| Title: | tearoff menu title ignored | |||
| Type: | Bug | Version: | obsolete: 8.5a4 | |
| Submitter: | fvogel | Created on: | 2005-11-03 21:39:17 | |
| Subsystem: | 10. Generic Menus | Assigned To: | fvogel | |
| Priority: | 7 High | Severity: | Minor | |
| Status: | Closed | Last Modified: | 2014-11-08 11:04:13 | |
| Resolution: | Invalid | Closed By: | fvogel | |
| Closed on: | 2014-11-08 11:04:13 | |||
| Description: |
From the menu man page, I can read about the -title option: "The string will be used to title the window created when this menu is torn off." So running the following snippet: menu .m -tearoff 0 -title "Nice menu" .m add command -label "hello world" .m add command -label [.m cget -title] .m clone .m.cl tearoff .m.cl post 150 200 I would expect that the torn-off menu title be "Nice menu". I observe that it is "cl", which I believe is a bug. | |||
| User Comments: |
fvogel added on 2014-11-08 11:04:13:
Thinking again at this I believe this is by design and on purpose. Closing my own report as invalid. fvogel added on 2014-11-02 19:57:29: While the snippet in the original report indeed produces a menu with unexpected name "cl", the following snippet works as expected:
package require Tk
catch {destroy .m}
menu .m -tearoff 1 -title "Nice menu"
.m add command -label "hello"
.m add command -label "world"
.m invoke 0
In that case the window showing the torn-off menu has the expected title "Nice menu".
In that second case, torn-off menu creation is done through invokation of the first dashed-line entry. In the source code, this runs TkInvokeMenu which in turn launches tk::TearOffMenu with .m as parameter. Then, looking in tearoff.tcl, the menu is cloned and the title of the window showing this menu is decided. It is at this place that the crucial code lines are run:
$w clone $menu tearoff
# Pick a title for the new menu by looking at the parent of the
# original: if the parent is a menu, then use the text of the active
# entry. If it's a menubutton then use its text.
set parent [winfo parent $w]
if {[$menu cget -title] ne ""} {
wm title $menu [$menu cget -title]
} else {
...
Running the snippet of the original report does not go through tk::TearOffMenu, which explains the difference in behavior.
Conclusion: Directly posting a cloned torned-off menu is not exactly the same as invoking the first entry of a tearoff menu.
Now, is this perhaps intended?
Opinions?
| |||
Home
Timeline
Branches
Tags
Forum
Tickets
Download
Wiki