NOTE:
I tried the following with x11 windowing system. I don't know
the behaviour with win32 and aqua.
Please try the following code:
----------------------------------------------------------------------------------------
wm withdraw .
frame .f1 -width 800 -height 800
frame .f2 -width 800 -height 800
button .f1.l -text Undock -command { Undock .f2 }
pack .f1.l
pack .f1 .f2
::tk::PlaceWindow . center
wm deiconify .
proc Undock {w} {
pack forget $w
wm manage $w
wm overrideredirect $w
wm protocol $w WM_DELETE_WINDOW [list Dock $w]
::tk::PlaceWindow $w center [winfo parent $w]
}
proc Dock {w} {
wm forget $w
pack $w
}
----------------------------------------------------------------------------------------
1. I'm using large windows too make it easier too see the problem.
2. "wm overrideredirect" is not working. It comes too late because
the (managed) window is already mapped. But I cannot use this
before managing.
3. The popup is flickering a lot. This has two reasons:
a) In function WmManageCmd (unix/tkUnixWm.c) you see:
2675: TkWmMapWindow(winPtr);
2676: Tk_UnmapWindow(frameWin);
This must flicker. These statements are superfluous.
I tried this without these two lines and the function
is working! But it flickers still a bit because:
b) ::tk::PlaceWindow comes too late because the
(managed) window is already mapped (normally
in the upper left corner). It should help if
"wm manage" has an option like -unmapped.
Without such an option the window cannot be placed
flicker-free. And without such an option you
cannot use "wm overrideredirect".
I have to make a correction:
I tried a more complex example after I removed the two lines 2675 and 2676 in
function WmManageCmd(), and it didn't work. This means these two lines are
NOT superfluous! But the flickering is still the problem. (Note: the simple example
above works without these two lines of code).