Author: Mark Roseman <email@example.com> Author: Francois Vogel <firstname.lastname@example.org> State: Final Type: Project Vote: Done Created: 19-Oct-2003 Post-History: Tcl-Version: 8.7
This TIP proposes changing the default value of the -tearoff option on menu widgets to false, from its current setting of true.
The default presence of tearoffs for Tk's menus originated with the Motif look & feel, which was the platform standard used for earlier Unix-only versions of Tk. In more modern user interface toolkits on Unix, as well as Macintosh and Windows, menus do not normally have tearoffs associated with them. For applications today, menus without tearoffs are the standard, with tearoff menus being the exception.
While turning off the tearoff on menus can be accomplished either with a configuration option on the particular menu, or a global option setting, this can be a source of confusion for the new Tk developer, and too easily forgotten by other developers. Forcing developers to take extra action to achieve "standard" user interface behavior is contrary to Tk's philosophy.
Implementation of this TIP requires only changing a single default in each of the platform specific tk*Default.h files, and updating the documentation and test cases.
Note that this change was already done in Nov. 2004, on OS X only, by
Indeed on OS X menues cannot be torn off.
Unfortunately, entries in menus are often accessed by index within scripts, and the presence or absence of tearoff affects this index. Therefore, changing the default setting of this option will affect a large number of scripts. Though fixing these scripts will be straightforward, because of the incompatibility this TIP was originally proposed for 9.0. However, after consultation of the community on the Tcl-core list, opinions were that this TIP can target 8.7. Should the old tearoff default need to be back, this can easily be achieved either through adjusting access to individual menus, or using the option database to turn the tearoff option back on through [option add *Menu.tearOff 1]
The following script returns 1, but will return 0 after implementation of this TIP:
package require Tk menu .m .m add cascade -label File -menu .m.file menu .m.file .m.file add command -label Item_1 . configure -menu .m puts "Item_1 is item number [.m.file index Item_1]"
See branch tip-161:
This document has been placed in the public domain.