Re: how to browse values from a GtkListStore ?
- From: for ad free fr
- To: Tadej Borovšak <tadeboro gmail com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: how to browse values from a GtkListStore ?
- Date: Sun, 15 Nov 2009 15:30:51 +0100
Selon Tadej Borovšak <tadeboro gmail com>:
Hello.
Is possible to browse them with an index ?
What is an index?
You can use gtk_tree_mogel_get_iter() to get an iter corresponding to
given position in the tree (as represented by GtkTreePath).
You can iterate using gtk_tree_iter_first()/gtk_tree_iter_next().
If index is mean as a row number, than you can directly access it
using a code like this:
---- CODE ----
GtkTreePath *path;
GtkTreeIter iter;
path = gtk_tree_path_new_from_indices( index, -1 );
gtk_tree_model_get_iter( model, &iter, path );
gtk_tree_path_free( path );
---- CODE ----
Tadej
--
Tadej Borovšak
tadeboro.blogspot.com
tadeboro gmail com
tadej borovsak gmail com
Ok, now I know how to browse using iteration, thanks.
But how to get values from an iteration / index ?
I have my GtkListStore fill with an array :
char *tab[] = {"apple", "banana", "orange"}
GtkTreePath *path;
GtkTreeIter iter;
path = gtk_tree_path_new_from_indices( 2, -1 );
gtk_tree_model_get_iter( model, &iter, path );
gtk_tree_path_free( path );
How to return string "orange" at iter ?
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]