I am using wm manage
and wm forget
to dock and undock a frame from a Tk application.
When I undock the frame f1
, sometimes the title bar of the view is not displayed. The frame does not undock correctly and so I can not handle it on the screen.
set f1 [winfo parent $w]
# get state of Dock button
set state [$T header state get DockBtn detach]
if {!$state} {
puts " -- detach, undock, deconnect"
# detach the widget f1
grid forget $f1
wm manage $f1
wm protocol $f1 WM_DELETE_WINDOW {}
event generate $f1 <<DetachedTab>>
set DockState 0
} else {
if {$DockState == 0} {
puts " -- attach, dock"
wm forget $f1
# add to my panedwindow f1
$panedW add $f1 -width 300
set DockState 1
}
}
I suspect the problem is that you use
grid forget
to detach the frame from the parent when converting to a managed window. However you use$panedW add
to re-attach it to the main application window. That suggests your parent is actually a panedwindow widget. This means the manager is not grid but panedwindow - you can test this usingwinfo manager $f1
. If this is the case you have conflicting window management. You need to be consistent in both parts of the function.