tixComboBox .c -label "Animal:" -editable true
.c insert end cat
.c insert end dog
.c insert end pig
In program 1-9, we set up a ComboBox .c for the user to select an animal to play with. If the user is just a dull person like you and me, he would just press the arrow button and select a pre-designated animal such as ``dog''. However, if he wants to try something new, he could type ``micky'' or ``sloth'' into the entry widget and he will get to play with his favorite animal.
Of course, sometimes we don't want too many sloths around us and we want to limit the range of the user's selections. In this case we can do one of two things. First, we can set the -editable option to false so that the user cannot type in the entry widget at all. Alternatively, we can use the -validatecmd option (see section 1.4.3) to check input the input.