Posted to tcl by patthoyts at Tue Oct 02 23:43:24 GMT 2007view pretty
# Demo spare window in the taskbar when using embedded safetk in a toplevel # The Main function is ok, only one taskbar entry created, but when we launch the # Dialog function we get a new black - we shouldn't because the dialog is # transient. proc Dialog {} { set dlg [toplevel .dlg -container 1] wm transient $dlg . wm title $dlg "SafeTk in dialog" safe::interpCreate dialog safe::loadTk dialog -use $dlg interp eval dialog {. configure -background red} bind $dlg <Destroy> [list interp delete dialog] .l configure -text "container: [winfo id $dlg]\ slave: [interp eval dialog {winfo id .}]" } proc Main {} { wm title . "Embed test" frame .f -container 1 label .l -text "" -anchor nw button .b -text Exit -command {set ::forever 1} button .b1 -text Dialog -command {Dialog} safe::interpCreate slave safe::loadTk slave -use .f slave eval {. configure -background blue} grid .f - -sticky news grid .l - -sticky news grid .b1 .b -sticky e grid rowconfigure . 0 -weight 1 grid columnconfigure . 0 -weight 1 bind . <Control-F2> {console show} tkwait variable ::forever } if {!$tcl_interactive} { set r [catch [linsert $argv 0 Main] err] if {$r} {tk_messageBox -icon error -message $::errorInfo} exit $r }