package require registry
label .show -text "Below is the list:"
grid .show -row 0 -column 0 -columnspan 2 -pady 3 -ipady 1
set count 0
set rootKey "HKEY_CURRENT_USER\\Software\\Microsoft\\VCExpress\\9.0\\ProjectMRUList"
foreach id [registry values $rootKey] {
if {[string length $id] >= 4} {
set text [registry get $rootKey $id]
ttk::checkbutton .$count -text $text -variable check($id)
grid .$count -column 0 -columnspan 4 -ipady 1 -sticky nsew
set check($id) 0
incr count 1
}
}
proc doClean {} {
foreach id [registry values $::rootKey] {
if {[string length $id] >= 4} {
    if {$::check($id) == 1} {    
        registry delete $::rootKey $id
    }
}
}
exit
}
# Let our button in next row
incr count 1
button .exit -text "Exit" -command exit
grid .exit -column 2 -row $count -pady 3 -ipady 1 -sticky nsew
button .clean -text "Clean" -command doClean
grid .clean -column 3 -row $count -pady 3 -ipady 1 -sticky nsew
Geometry Manager 使用 grid 來管理。
 
沒有留言:
張貼留言