wm title . "Combobox Example" ## ## supporting proc to dynamically ## change the second list ## proc updateList2 {} { global lst set sel [.cb1 get] ## ## Clear the lists and entries ## for the second and third comboboxes ## Note that the combobox needs to have ## -editable set to true in order ## to clear the entry widget ## .cb2 delete list 0 end .cb2 delete entry 0 end .cb3 delete list 0 end .cb3 delete entry 0 end eval .cb2 insert list end $lst($sel) return }; # end proc updateList2 ## ## supporting proc to dynamically ## change the third list ## proc updateList3 {} { global lst set sel [.cb2 get] .cb3 delete list 0 end .cb3 delete entry 0 end eval .cb3 insert list end $lst($sel) return }; # end proc updateList3 ## ## Some lists to populate the ## comboboxes ## set lst(1) [list Linux Windows] set lst(Linux) [list RedHat SuSE] set lst(Windows) [list Microsoft] set lst(RedHat) [list 6.0 6.1 6.2 7.0 7.1] set lst(SuSE) [list 6.0 6.1 6.2 6.3 6.4 7.0 7.1] set lst(Microsoft) [list Win95 Win98 WinNT Win2000 WinME] ##========================================================= ## Create several Combobox iwidgets ##========================================================= ## ## Non-editable Dropdown Combobox iwidgets::combobox .cb1 \ -labeltext OS: \ -editable false \ -arrowrelief ridge \ -popupcursor hand2 \ -selectioncommand updateList2 ## Editable Dropdown Combobox iwidgets::combobox .cb2 \ -labeltext "Vendor:" \ -arrowrelief ridge \ -completion false \ -popupcursor hand2 \ -selectioncommand updateList3 ## Simple Combobox iwidgets::combobox .cb3 \ -labeltext Version: \ -arrowrelief ridge \ -popupcursor hand2 \ -dropdown false ## ## Add the first combox list ## eval .cb1 insert list 0 $lst(1) pack .cb1 .cb2 .cb3 \ -padx 10 \ -pady 10 \ -fill x iwidgets::Labeledwidget::alignlabels .cb1 .cb2 .cb3