wm title . "Selectiondialog Example"
##
## Helper procs
##
proc entrySelect {} {
puts "Entry value: [.sd component selection get]"
return
}; # end proc entrySelect
proc listSelect {} {
puts "Listbox value: [.sd get]"
.sd selectitem
return
}; # end proc listSelect
##=========================================================
## Create a selectiondialog iwidget
##=========================================================
##
iwidgets::selectiondialog .sd \
-childsitepos w \
-selectioncommand entrySelect \
-itemscommand listSelect \
-textbackground lightblue \
-selectbackground gray \
-selectforeground white \
-title "Selectiondialog Example" \
-itemslabel "Iwidgets Library" \
-modality application
##
## Add some items to the listbox
##
cd ${iwidgets::library}/scripts
eval .sd insert items end [glob -nocomplain *.itk]
##
## Modify the buttonbox
##
.sd hide Apply
.sd buttonconfigure OK \
-text "View"
##
## Activate and wait for user input
##
if [.sd activate] {
puts "Selected [.sd get]"
}
|