# pkgIndex.tcl package ifneeded mclistbox 1.02 \ [list tclPkgSetup $dir mclistbox 1.02 {{mclistbox.tcl source ::mclistbox::mclistbox}}] |
package require mclistbox namespace import mclistbox::* frame .container -bd 2 -relief sunken scrollbar .vsb -orient vertical -command [list .listbox yview] scrollbar .hsb -orient horizontal -command [list .listbox xview] mclistbox .listbox -labelanchor w -width 60 -height 5 \ -fillcolumn address \ -xscrollcommand [list .hsb set] \ -yscrollcommand [list .vsb set] .listbox column add name -label "名前" -width 16 .listbox column add phone -label "電話番号" -width 14 .listbox column add address -label "住所" -width 30 grid .vsb -in .container -row 0 -column 1 -sticky ns grid .hsb -in .container -row 1 -column 0 -sticky ew grid .listbox -in .container -row 0 -column 0 -sticky nsew grid columnconfigure .container 0 -weight 1 grid columnconfigure .container 1 -weight 0 grid rowconfigure .container 0 -weight 1 grid rowconfigure .container 1 -weight 0 pack .container -side top -fill both -expand y # 項目を挿入する .listbox insert end {太郎 03-1234-5678 東京都調布市1-2-3} .listbox insert end {花子 044-1234-5678 神奈川県川崎市1-2-3} .listbox insert end {一郎 070-1234-5678 埼玉県おおみや市1-2-3} # 名前でソートする .listbox label bind name |