This is not necessarily the current version of this TIP.
| TIP: | 125 |
| Title: | Adding [wm toplevel] Subcommand |
| Version: | $Revision: 1.2 $ |
| Author: | Brian Griffin <bgriffin at model dot com> |
| State: | Draft |
| Type: | Project |
| Tcl-Version: | 8.5 |
| Vote: | Pending |
| Created: | Monday, 20 January 2003 |
| Keywords: | reparent |
This TIP adds the "wm toplevel" command that will change a Frame into a Toplevel and visa versa.
One of the usability features introduced recently in many windowing systems, is the ability to "tear out" or "insert" sub-frames and panes within an application. The most common form of this is the ability to tear off a toolbar, making it an independent window. This feature gives the end user the ability to configure the application in ways that best suit them and improve their overall productivity.
Currently there is no mechanism with Tk to move a widget subtree to a new toplevel parent without reconstructing the hierarchy from scratch. The basic command will give the Tk programmer the ability to implement megawidgets that support tear-off toolbars, notebooks, etc., since the children widgets of the frame will follow along, unchanged.
ftp://ftp.model.com/pub/tcl/reframe contains patch files as well as Linux and Win32 builds of 8.3.4 and 8.4.1.
The demo.tcl file illustrates the basic function.
The reference implementation works on Windows and Linux. A Mac implementation has not been performed due to a lack of resources. (I ain't got no Mac)
What happens with "." (the main window) or when -use/-container options are in use is unknown. Most likely, these conditions would restrict the use of this command.
What to do with menus which can be part of a Toplevel?
An alternative to extending the wm command is to make this feature either a method or a configure option of the Toplevel and Frame widget.
A. [$w detach] to convert a Frame into a Toplevel, and [$w attach] to convert a Toplevel into a Frame.
B. [$w configure -toplevel 1] to convert a Frame into a Toplevel, and [$w configure -toplevel 0] to convert a Toplevel into a Frame.
These different approaches (wm, method, config) depend on how the feature is viewed. One view is that the of changing the nature or class (Toplevel, Frame) of the widget. An alternative view is that of changing "who" manages the widget (wm, place, grid, pack).
I suppose another alternative is to follow the precedent of the geometry managers:
* wm $w ?-transient <parent>? ?-overrideredirect <boolean>? ...
* wm forget $w
This document has been placed in the public domain.
This is not necessarily the current version of this TIP.