Tk Source Code

Artifact [63d97862]
Login

Artifact 63d97862d7a51aaa50083193374f575b6c058602:

Attachment "wm_manage.tcl" to ticket [3205464f] added by beric 2011-03-10 21:12:38.

package require Tk 8.5

ttk::notebook .nb
bind .nb <ButtonPress-3> {
    if {[set idx [.nb index "@%x,%y"]] ne ""} {
        set w [lindex [.nb tabs] $idx]
        wm manage $w.holder
        wm protocol $w.holder WM_DELETE_WINDOW [subst {
            wm forget $w.holder
            pack $w.holder -fill both -expand yes
        }]
    }
}

for {set count 1} {$count < 5} {incr count} {
    set label "Page $count"
    set page    [frame .nb.page$count]
    set holder  [frame $page.holder]
    set content [label $holder.content -text $label -background red]
    pack $content
    pack $holder -fill both -expand yes
    .nb add $page -text $label
}

pack .nb -fill both -expand yes