gtk_combo_box_new_text() API



Hello,

The GTK+ Reference Manual states that a combo box created with
gtk_combo_box_new_text() should only be manipulated with the functions
gtk_combo_box_append_text(), gtk_combo_box_insert_text(),
gtk_combo_box_prepend_text() and gtk_combo_box_remove_text().

I am interested in removing all text entries from such a combo box. With
the specified API this seems impossible unless I know how many items are
in the combo box, as gtk_combo_box_remove_text() wants me to specify the
index of the element I want to remove.

It is not specified in the documentation how elements indexes change
after I remove an element, but I guess if I remove the element with the
index 0 over and over again, the combo box will be empty eventually.
Unfortunately gtk_combo_box_remove_text() doesn't have a return value
which would tell me that there was no element with that index, so I
could stop removing it.

So, in short, either the gtk_combo_box_*_text()-API is unusable for this
specific task (remove all enries if the indexes (which are not returned
upon creation of entries with _append_text(), btw) of the entries are
unknown), or I am to stupid to understand the documentation. As I guess
it is the latter I ask you to enlighten me. :-)

Version Info:
ii  libgtk2.0-dev    2.20.1-2
ii  libgtk2.0-doc    2.20.1-2
(Debian Sid)

Regards,
Timo



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]