Simple way to determine index of selected item in GtkCombo?
- From: Gus Koppel <gtk spamkiller bytechase cx>
- To: <gtk-app-devel-list gnome org>
- Subject: Simple way to determine index of selected item in GtkCombo?
- Date: Tue, 23 Sep 2003 21:52:52 +0200
I have a non-editable GtkCombo with list entries i.e. "A", "B", "C" and
"D". If the user selects "C" I am interested in the index of that item,
not its value. For the latter I would use gtk_entry_get_text (). I'd
rather get the information that the 3rd item was being chosen.
Since I couldn't find anything helpful I wrote my own function to obtain
the index number of the chosen item. Though it's short and works basically
flawlessly and returns the expected results it's quite a bit ugly because
- it accesses deprecated GTK features (GtkList)
- it directly accesses GTK object structure members
- it performs numerous memory allocations and deallocations per call
- it only handles simple GtkLabel-based list entries
- it's probably rather slow
That's why I just wanted to ask whether I have overlooked an internal
(or otherwise less ugly) solution in GTK+ 2.2 for this?
GtkOptionMenu's are not suitable for me, for optical and layout reasons.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]