Next: Monitoring the User's Up: Another Tix Widget: Previous: Controlling the Style


Static Options 

The -dropdown and -fancy options are so-called ``static options''. They can only be set during the creation of the ComboBox. Hence this code is valid:

tixComboBox .c -dropdown true

But the following code will generate an error because it attempts to set the -dropdown option after the ComboBox has already been created.

TixComboBox .c
.c config -dropdown true

The restrictions of the static options, although annoying, nevertheless make sense because we don't want our interface to suddenly change its style. If sometimes a button is there and sometimes it disappear all by itself, that will certainly create a lot of confusion and makes the user wonder why he should buy our software. Also, as you will see in chapter 6, having some static options will make the life of widget writers a lot easier.

Accessing the value of the ComboBox is very similar to accessing the value of the TixControl widget. The ComboBox has these four options, which we discussed in section 1.2.2: -value, -variable, -command and -validatecmd. You can use these four options to access the user input and respond to user actions in exactly the same way as discussed in section 1.2.2.