Phone book example using Metakit

Lectus: I've been playing with Metakit and here is an example program using it:

Phone book using Metakit:

# Loading required packages: Tk and Metakit
package req Tk
package req Mk4tcl

# proc to create the GUI
proc GUI {} {
        # Code to create the GUI using Tk 8.5
        wm title . "Phone Book"
        ttk::frame .top
        
        ttk::label .top.lName -text Name:
        ttk::entry .top.eName
        
        ttk::label .top.lPhone -text Phone:
        ttk::entry .top.ePhone

        ttk::button .top.bAdd -text Add -command {
                .tv insert {} end -values [list [.top.eName get] [.top.ePhone get]]
                mk::row append $vw Name [.top.eName get] Phone [.top.ePhone get]
                mk::file commit db        
        }

        eval pack [winfo children .top] -side left -padx 5 -pady 5
        pack .top -fill both -expand 1
        
        ttk::scrollbar .sb -orient vert
        ttk::treeview .tv -columns {Name Phone} -show headings

        pack .tv .sb -fill both -expand 1 -padx 5 -pady 5 -side left

        .tv conf -yscrollcommand {.sb set}
        .sb conf -command {.tv yview}        
        .tv heading Name -text Name
        .tv heading Phone -text Phone

        focus .top.eName

        # Event: when the user presses DEL the selected row will be deleted from the treeview and database
        bind .tv <Delete> {
                set itens [.tv item [.tv selection] -values]
                foreach i [mk::select db.phonebook -exact Name [lindex $itens 0]] {
                        #tk_messageBox -message $i
                        mk::row delete db.phonebook!$i
                }
                .tv delete [.tv selection]
        }
}

# proc to load the database file and put the contents in the treeview
proc loadDB {} {
        global vw
        mk::file open db db.txt
        set vw [mk::view layout db.phonebook {Name Phone}]
        mk::loop c db.phonebook {
                .tv insert {} end -values [mk::get $c Name Phone]
                }                
}

# Call the procs
GUI
loadDB

I wrote this program for fun and learning. It's incomplete and maybe buggy, but I think it serves as a reference for ttk::treeview and metakit.