1ttk::combobox(n) Tk Themed Widget ttk::combobox(n)
2
3
4
5______________________________________________________________________________
6
8 ttk::combobox - text field with popdown selection list
9
11 ttk::combobox pathName ?options?
12______________________________________________________________________________
13
15 A ttk::combobox combines a text field with a pop-down list of values;
16 the user may select the value of the text field from among the values
17 in the list.
18
20 -class -cursor -takefocus
21 -style
22
23 See the ttk_widget manual entry for details on the standard options.
24
26 Command-Line Name:-exportselection
27 Database Name: exportSelection
28 Database Class: ExportSelection
29
30 Boolean value. If set, the widget selection is linked to the X
31 selection.
32
33 Command-Line Name:-justify
34 Database Name: justify
35 Database Class: Justify
36
37 Specifies how the text is aligned within the widget. Must be
38 one of left, center, or right.
39
40 Command-Line Name:-height
41 Database Name: height
42 Database Class: Height
43
44 Specifies the height of the pop-down listbox, in rows.
45
46 Command-Line Name:-postcommand
47 Database Name: postCommand
48 Database Class: PostCommand
49
50 A Tcl script to evaluate immediately before displaying the list‐
51 box. The -postcommand script may specify the -values to dis‐
52 play.
53
54 Command-Line Name:-state
55 Database Name: state
56 Database Class: State
57
58 One of normal, readonly, or disabled. In the readonly state,
59 the value may not be edited directly, and the user can only
60 select one of the -values from the dropdown list. In the normal
61 state, the text field is directly editable. In the disabled
62 state, no interaction is possible.
63
64 Command-Line Name:-textvariable
65 Database Name: textVariable
66 Database Class: TextVariable
67
68 Specifies the name of a global variable whose value is linked to
69 the widget value. Whenever the variable changes value the wid‐
70 get value is updated, and vice versa.
71
72 Command-Line Name:-values
73 Database Name: values
74 Database Class: Values
75
76 Specifies the list of values to display in the drop-down list‐
77 box.
78
79 Command-Line Name:-width
80 Database Name: width
81 Database Class: Width
82
83 Specifies an integer value indicating the desired width of the
84 entry window, in average-size characters of the widget's font.
85
87 The following subcommands are possible for combobox widgets:
88
89 pathName current ?newIndex?
90 If newIndex is supplied, sets the combobox value to the element
91 at position newIndex in the list of -values (in addition to
92 integers, the end index is supported and indicates the last ele‐
93 ment of the list). Otherwise, returns the index of the current
94 value in the list of -values or -1 if the current value does not
95 appear in the list.
96
97 pathName get
98 Returns the current value of the combobox.
99
100 pathName set value
101 Sets the value of the combobox to value.
102
103 The combobox widget also supports the following ttk::entry widget sub‐
104 commands (see ttk::entry(n) for details):
105
106 bbox delete icursor
107 index insert selection
108 xview
109
110 The combobox widget also supports the following generic ttk::widget
111 widget subcommands (see ttk::widget(n) for details):
112
113 cget configure identify
114 instate state
115
116
118 The combobox widget generates a <<ComboboxSelected>> virtual event when
119 the user selects an element from the list of values. If the selection
120 action unposts the listbox, this event is delivered after the listbox
121 is unposted.
122
124 The class name for a ttk::combobox is TCombobox. The ttk::combobox
125 uses the entry and listbox widgets internally. The listbox frame has a
126 class name of ComboboxPopdownFrame.
127
128 Dynamic states: disabled, focus, pressed, readonly.
129
130 TCombobox styling options configurable with ttk::style are:
131
132 -arrowcolor color
133 -arrowsize amount
134 -background color
135 -bordercolor color
136 -darkcolor color
137 -focusfill color
138 -foreground color
139 -fieldbackground color
140 Can only be changed when using non-native and non-graphical
141 themes.
142 -insertwidth amount
143 -lightcolor color
144 -padding padding
145 -postoffset padding
146 -selectbackground color
147 Text entry select background.
148 -selectforeground color
149 Text entry select foreground.
150
151 The ttk::combobox popdown listbox cannot be configured using ttk::style
152 nor via the widget configure command. The listbox can be configured
153 using the option database.
154
155 option add *TCombobox*Listbox.background color
156 option add *TCombobox*Listbox.font font
157 option add *TCombobox*Listbox.foreground color
158 option add *TCombobox*Listbox.selectBackground color
159 option add *TCombobox*Listbox.selectForeground color
160
161 To configure a specific listbox (subject to future change):
162 set popdown [ttk::combobox::PopdownWindow .mycombobox]
163 $popdown.f.l configure -font font
164
165 ComboboxPopdownFrame styling options configurable with ttk::style are:
166
167 -borderwidth amount
168 -relief relief
169
170 Some options are only available for specific themes.
171
172 See the ttk::style manual page for information on how to configure ttk
173 styles.
174
176 ttk::widget(n), ttk::entry(n)
177
179 choice, entry, list box, text box, widget
180
181
182
183Tk 8.5 ttk::combobox(n)