summaryrefslogtreecommitdiff
path: root/docs/reference/pygtk-gtkcombo.xml
blob: 9e58d5757575e90bba6c0cd012764e381917f790 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
<?xml version="1.0" standalone="no"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
    "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">

<refentry id="class-gtkcombo">
  <refnamediv>
    <refname>gtk.Combo</refname>
    <refpurpose>a text entry field with a dropdown list.</refpurpose>
  </refnamediv>

  <refsect1>
    <title>Synopsis</title>

    <classsynopsis language="python">
      <ooclass><classname>gtk.Combo</classname></ooclass>
      <ooclass><classname><link
linkend="class-gtkhbox">gtk.HBox</link></classname></ooclass>
      <constructorsynopsis language="python">
	<methodname><link
linkend="constructor-gtkcombo">gtk.Combo</link></methodname>
	<methodparam></methodparam>  </constructorsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkcombo--set-value-in-list">set_value_in_list</link></methodname>
	<methodparam><parameter role="keyword">val</parameter></methodparam>
	<methodparam><parameter
		       role="keyword">ok_if_empty</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkcombo--set-use-arrows">set_use_arrows</link></methodname>
	<methodparam><parameter role="keyword">val</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkcombo--set-use-arrows-always">set_use_arrows_always</link></methodname>
	<methodparam><parameter role="keyword">val</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkcombo--set-case-sensitive">set_case_sensitive</link></methodname>
	<methodparam><parameter role="keyword">val</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkcombo--set-item-string">set_item_string</link></methodname>
	<methodparam><parameter
		       role="keyword">item</parameter></methodparam>
	<methodparam><parameter
		       role="keyword">item_value</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkcombo--set-popdown-strings">set_popdown_strings</link></methodname>
	<methodparam><parameter
		       role="keyword">strings</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkcombo--disable-activate">disable_activate</link></methodname>
	<methodparam></methodparam>  </methodsynopsis>
    </classsynopsis>

  </refsect1>

  <refsect1>
    <title>Ancestry</title>

<synopsis>+-- <link linkend="class-gobject">gobject.GObject</link>
  +-- <link linkend="class-gtkobject">gtk.Object</link>
    +-- <link linkend="class-gtkwidget">gtk.Widget</link>
      +-- <link linkend="class-gtkcontainer">gtk.Container</link>
        +-- <link linkend="class-gtkbox">gtk.Box</link>
          +-- <link linkend="class-gtkhbox">gtk.HBox</link>
            +-- <link linkend="class-gtkcombo">gtk.Combo</link>
</synopsis>

  </refsect1>
  
  <refsect1>
		<title>Implemented Interfaces</title>
		<para>
			<link linkend="class-gtkcombo"><classname>gtk.Combo</classname></link>
			implements 
			<link linkend="class-gtkbuildable"><classname>gtk.Buildable</classname></link>
		</para>
	</refsect1>


  <refsect1 id="properties-gtkcombo">
    <title>gtk.Combo Properties</title>

    <para><link linkend="properties-gtkobject">gtk.Object Properties</link></para>
    <para><link linkend="properties-gtkwidget">gtk.Widget Properties</link></para>
    <para><link linkend="properties-gtkcontainer">gtk.Container Properties</link></para>
    <para><link linkend="properties-gtkbox">gtk.Box Properties</link></para>

    <blockquote role="properties">
      <informaltable pgwide="1" frame="none">
	<tgroup cols="3">
	  <colspec column="1" colwidth="1in"/>
	  <colspec column="2" colwidth="1in"/>
	  <colspec column="3" colwidth="3.5in"/>
	  <tbody>

            <row valign="top">
              <entry>"allow-empty"</entry>
              <entry>Read/Write</entry>
              <entry>If <literal>True</literal>, an empty value may be entered
              in this field</entry>
            </row>
            <row valign="top">
              <entry>"case-sensitive"</entry>
              <entry>Read/Write</entry>
              <entry>If <literal>True</literal>, list item matching is case
              sensitive</entry>
            </row>
            <row valign="top">
              <entry>"enable-arrow-keys"</entry>
              <entry>Read/Write</entry>
              <entry>If <literal>True</literal>, the arrow keys move through the
              list of items</entry>
            </row>
            <row valign="top">
              <entry>"enable-arrows-always"</entry>
              <entry>Read/Write</entry>
              <entry>If <literal>True</literal>, the arrow keys work, even if
              the entry contents are not in the list</entry>
            </row>
            <row valign="top">
              <entry>"value-in-list"</entry>
              <entry>Read/Write</entry>
              <entry>If <literal>True</literal>, entered values must already be
              present in the list</entry>
            </row>

          </tbody>
        </tgroup>
      </informaltable>
    </blockquote>

  </refsect1>

  <refsect1 id="style-properties-gtkcombo">
    <title>gtk.Combo Style Properties</title>

    <para><link linkend="style-properties-gtkwidget">gtk.Widget Style Properties</link></para>

  </refsect1>

  <refsect1 id="child-properties-gtkcombo">
    <title>gtk.Combo Child Properties</title>

    <para><link linkend="child-properties-gtkbox">gtk.Box Child Properties</link></para>

  </refsect1>

  <refsect1>
    <title>Attributes</title>

    <blockquote role="properties">
      <informaltable pgwide="1" frame="none">
	<tgroup cols="3">
	  <colspec column="1" colwidth="1in"/>
	  <colspec column="2" colwidth="1in"/>
	  <colspec column="3" colwidth="3.5in"/>
	  <tbody>

	    <row valign="top">
	      <entry>"entry"</entry>
	      <entry>Read</entry>
	      <entry>the text entry widget</entry>
	    </row>

	    <row valign="top">
	      <entry>"list"</entry>
	      <entry>Read</entry>
	      <entry>the list shown in the drop-down window</entry>
	    </row>

	  </tbody>
	</tgroup>
      </informaltable>
    </blockquote>

  </refsect1>

  <refsect1 id="signal-prototypes-gtkcombo">
    <title>gtk.Combo Signal Prototypes</title>

    <para><link linkend="signal-prototypes-gobject">gobject.GObject Signal Prototypes</link></para>
    <para><link linkend="signal-prototypes-gtkobject">gtk.Object Signal Prototypes</link></para>
    <para><link linkend="signal-prototypes-gtkwidget">gtk.Widget Signal Prototypes</link></para>
    <para><link linkend="signal-prototypes-gtkcontainer">gtk.Container Signal Prototypes</link></para>
  </refsect1>

  <refsect1>
    <title>Description</title>

    <note>
      <para>The <link
      linkend="class-gtkcombo"><classname>gtk.Combo</classname></link> is
      deprecated in GTK+ 2.4 and PyGTK 2.4 in favor of the <link
      linkend="class-gtkcombobox"><classname>gtk.ComboBox</classname></link>.</para>
    </note>

    <para>The <link
linkend="class-gtkcombo"><classname>gtk.Combo</classname></link> widget
consists of a single-line text entry field and a drop-down list. The
drop-down list is displayed when the user clicks on a small arrow button to
the right of the entry field. The drop-down list is a
<classname>gtk.List</classname> widget and can be accessed using the list
attribute of the <link
linkend="class-gtkcombo"><classname>gtk.Combo</classname></link>. List
elements can contain arbitrary widgets, but if an element is not a plain
label, then you must use the
<methodname>gtk.List.set_item_string</methodname>() method. This sets the
string which will be placed in the text entry field when the item is
selected.</para>

    <para>By default, the user can step through the items in the list using
the arrow (cursor) keys, though this behavior can be turned off with the
<link
linkend="method-gtkcombo--set-use-arrows"><methodname>set_use_arrows</methodname>()</link> 
method. Normally the arrow keys are only active when the contents of the
text entry field matches one of the items in the list. If the contents of
the entry field do not match any of the list items, then pressing the arrow
keys does nothing. However, by calling <link
linkend="method-gtkcombo--set-use-arrows"><methodname>set_use_arrows_always</methodname>()</link> 
you can specify that the arrow keys are always active. If the contents of
the entry field does not match any of the items in the list, then pressing
the up or down arrow key will set the entry field to the last or first item
in the list, respectively.</para>

    <para>Note the list attribute references a gtk.List which is a
deprecated widget so the combo widget may be changed or deprecated in the
future.</para>

  </refsect1>

  <refsect1 id="constructor-gtkcombo">
    <title>Constructor</title>

    <programlisting><constructorsynopsis language="python">
	<methodname>gtk.Combo</methodname>
	<methodparam></methodparam>  </constructorsynopsis></programlisting>
    <variablelist>
      <varlistentry>
	<term><emphasis>Returns</emphasis>&nbsp;:</term>
	<listitem><simpara>a combo object*</simpara></listitem>
      </varlistentry>
    </variablelist>

    <para>Creates an new <link
linkend="class-gtkcombo"><classname>gtk.Combo</classname></link>
object.</para>

  </refsect1>

  <refsect1>
    <title>Methods</title>

    <refsect2 id="method-gtkcombo--set-value-in-list">
      <title>gtk.Combo.set_value_in_list</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_value_in_list</methodname>
	  <methodparam><parameter
			 role="keyword">val</parameter></methodparam>
	  <methodparam><parameter
			 role="keyword">ok_if_empty</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">val</parameter>&nbsp;:</term>
	  <listitem><simpara>If True the value entered must match one of the
values in the list.</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter
role="keyword">ok_if_empty</parameter>&nbsp;:</term>
	  <listitem><simpara>If True an empty value is considered
valid.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>set_value_in_list</methodname>() method
specifies whether the value entered in the text entry field must match one
of the values in the list. This method sets the "value-in-list" property to
the value of <parameter>val</parameter> and the "allow-empty" property to
the value of <parameter>ok_if_empty</parameter>.</para>

      <para>If <parameter>val</parameter> is True the user will not be able
to perform any other action (the widget grabs the focus) until a valid value
has been entered. If <parameter>ok_if_empty</parameter> is True an empty
field is considered an acceptable value.</para>

    </refsect2>

    <refsect2 id="method-gtkcombo--set-use-arrows">
      <title>gtk.Combo.set_use_arrows</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_use_arrows</methodname>
	  <methodparam><parameter
			 role="keyword">val</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">val</parameter>&nbsp;:</term>
	  <listitem><simpara>If True can be used to navigate through the
list items</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>set_use_arrows</methodname>() method sets the
"enable-use-arrows" property to the value of <parameter>val</parameter>. If
<parameter>val</parameter> is True the arrows keys can be used to navigate
through the list items.</para>

    </refsect2>

    <refsect2 id="method-gtkcombo--set-use-arrows-always">
      <title>gtk.Combo.set_use_arrows_always</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_use_arrows_always</methodname>
	  <methodparam><parameter
			 role="keyword">val</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">val</parameter>&nbsp;:</term>
	  <listitem><simpara>If True the arrow keys will still work even if
the text entry field does not match any of the list
items.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>set_use_arrows_always</methodname>() method sets
the "enable-arrows-always" property to the values of
<parameter>val</parameter>. If <parameter>val</parameter> is True the arrow
keys will work even if the text entry field does not match any of the list
items.</para>

    </refsect2>

    <refsect2 id="method-gtkcombo--set-case-sensitive">
      <title>gtk.Combo.set_case_sensitive</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_case_sensitive</methodname>
	  <methodparam><parameter
			 role="keyword">val</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">val</parameter>&nbsp;:</term>
	  <listitem><simpara>If True the text in the list items is case
sensitive.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>set_case_sensitive</methodname>() method sets
the "case-sensitive" property to the value of <parameter>val</parameter>. If
<parameter>val</parameter> is True the text in the combo list items and the
text entry field are case sensitive. The default value of
"set-case-sensitive" is False.</para>

    </refsect2>


    <refsect2 id="method-gtkcombo--set-item-string">
      <title>gtk.Combo.set_item_string</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_item_string</methodname>
	  <methodparam><parameter
			 role="keyword">item</parameter></methodparam>
	  <methodparam><parameter
			 role="keyword">item_value</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">item</parameter>&nbsp;:</term>
	  <listitem><simpara>a list item</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter
role="keyword">item_value</parameter>&nbsp;:</term>
	  <listitem><simpara>a string to place in the entry field when
<parameter>item</parameter> is selected</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>set_item_string</methodname>() method sets the
string (from <parameter>item_value</parameter>) to place in the combo text
entry field when the <parameter>item</parameter> is selected. This method is
only needed if the list item is other than a simple label (e.g. a
pixmap).</para>

    </refsect2>


    <refsect2 id="method-gtkcombo--set-popdown-strings">
      <title>gtk.Combo.set_popdown_strings</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_popdown_strings</methodname>
	  <methodparam><parameter
			 role="keyword">strings</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">strings</parameter>&nbsp;:</term>
	  <listitem><simpara>a list of strings to populate the
list</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>set_popdown_strings</methodname>() method is a
convenience method that sets the strings used in the popdown list from.
<parameter>strings</parameter> (a Python list or tuple object).</para>

    </refsect2>


    <refsect2 id="method-gtkcombo--disable-activate">
      <title>gtk.Combo.disable_activate</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>disable_activate</methodname>
	  <methodparam></methodparam>  </methodsynopsis></programlisting>

      <para>The <methodname>disable_activate</methodname>() method prevents
the combo from showing the popup list when the entry emits the "activate"
signal, i.e. when the <keycap>Return</keycap> key is pressed. This may be
useful if, for example, you want the <keycap>Return</keycap> key to close a
dialog instead. </para>

    </refsect2>

  </refsect1>

</refentry>