wm title . "Selectionbox Example" ## ## Helper procs ## proc entrySelect {} { puts "Entry value: [.sb component selection get]" return }; # end proc entrySelect proc listSelect {} { puts "Listbox value: [.sb get]" .sb selectitem return }; # end proc listSelect ##========================================================= ## Create a selectionbox iwidget ##========================================================= ## iwidgets::selectionbox .sb \ -childsitepos w \ -selectioncommand entrySelect \ -itemscommand listSelect \ -selectbackground blue \ -selectforeground white pack .sb ## ## Add another label in the childsite ## font create lbl_font \ -family Helvetica \ -size 16 \ -weight bold set cs [.sb childsite] label $cs.label \ -text [join [split " Iwidgets Library" ""] \n] \ -foreground blue \ -font lbl_font pack $cs.label \ -padx 4 \ -pady 4 ## ## Add some items to the listbox ## cd ${iwidgets::library}/scripts eval .sb insert items end [glob -nocomplain *.itk]