Re: Get active text from GtkComboBox
- From: Stefan Kost <kost imn htwk-leipzig de>
- To: martyn russell bt com
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Get active text from GtkComboBox
- Date: Mon, 13 Dec 2004 13:56:00 +0100
A followup question:
should there be a g_object_unref(model); at the end of the function ?
Stefan
Martyn Russell wrote:
On Sun, 2004-12-12 at 16:36 -0200, cesarbs brturbo com wrote:
Hello,
My program has a GtkComboBox created with gtk_combo_box_new_text (),
and I would like to know how could I grab the active text on it. I
know there's a function called gtk_combo_box_get_active_text(), but
that only works with GTK+-2.6 that's still under development.
How could I do that in GTK+-2.4?
The following should work:
GtkTreeModel *model;
GtkTreeIter iter;
model = gtk_combo_box_get_model (combo_box);
if (gtk_combo_box_get_active_iter (combo_box, &iter)) {
gchar *str = NULL;
gtk_tree_model_get (model, &iter, 0, &str, -1);
/* do something with str */
g_free (str);
}
--
\|/ Stefan Kost
<@ @> private business
+-oOO-(_)-OOo------------------------------------------------------ - - - - -
| __ Address Simildenstr. 5 HTWK Leipzig, Fb IMN, Postfach 301166
| /// 04277 Leipzig 04251 Leipzig
| __ /// Germany Germany
| \\\/// Phone +49341 2253538 +49341 30766101
| \__/ EMail st_kost_at_gmx.net kost_at_imn.htwk-leipzig.de
| WWW www.sonicpulse.de www.imn.htwk-leipzig.de/~kost/about.html
===-=-=--=---=---------------------------------- - - - - -
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]