Re: gtk_list_store_new(1, G_TYPE_STRING) and retrieving data



On Wed, 7 Sep 2005 13:52:34 -0400 
"Faria, Sydney C" <sydney faria pw utc com> wrote:

I made a GtkListStore model and populated it with data entries and view it
via a GtkTreeView no problem.  Now I want to use a button click callback to
scan through the list
to access all the items to print them out.  I found
gtk_tree_model_iter_next(model, iter) and gtk_tree_model_getvalue(model,
iter, column, value) and thought that might be the way to go:  then I found
gtk_tree_model_foreach(model, GtkTreeModelForeachFunc, data) and
GtkTreeModelForeachFunc(model, PATH, iter, data)!  The latter 2 methods look
like the easier path to follow but the documentation here is very sparse!
I'm trying to iterate through a list so what does PATH have to do with this?
I sure would like to see an example of these two techniques so any comments
and/or skeleton code would certainly be well appreciated.

use
gtk_tree_model_foreach (model, model_foreach, NULL);

static gboolean model_foreach (GtkTreeModel *model,
                                        GtkTreePath *path,
                                        GtkTreeIter *iter,
                                        gpointer data)
{
  gtk_tree_model_get (model, iter,
                      COLUMN, &value,
                      -1);

  return FALSE;
}


-- 
HuamiSoft Hubert Sokolowski
http://www.huamisoft.com/
tel. 501456743



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