View previous topic :: View next topic |
Author |
Message |
Mengu
Joined: 21 Mar 2010 Posts: 21
|
Posted: Sat Apr 10, 2010 8:55 am Post subject: About GtkTreeModelForeachFunc |
|
|
Hi,
I would like to get all the elements in a treeview with its model liststore and I see I have to use GtkTreeModelForeachFunc but I have no idea on using it. Some help would be great.
Thanks in advance. _________________ mengu.net - some kind of monster |
|
Back to top |
|
|
Mengu
Joined: 21 Mar 2010 Posts: 21
|
Posted: Sat Apr 10, 2010 6:28 pm Post subject: |
|
|
I have dealed with this with iterNext method, however I really would like to understand how GtkTreeModelForeachFunc works. _________________ mengu.net - some kind of monster |
|
Back to top |
|
|
Mike Wey
Joined: 07 May 2007 Posts: 428
|
Posted: Sun Apr 11, 2010 8:10 am Post subject: |
|
|
You would use it like this:
Code: | myModel.foreac(&foreachNodeFunc, null);
static extern(C) bool foreachNodeFunc(GtkTreeModel* model, GtkTreePath* path, GtkTreeIter* iter, void* data)
{
TreeModel treemodel = new TreeModel(model);
TreePath treepath = new TreePath(path);
TreeIter treeIter = new TreeIter(iter);
//Do something with the model/iter
} |
|
|
Back to top |
|
|
Mengu
Joined: 21 Mar 2010 Posts: 21
|
Posted: Sun Apr 11, 2010 11:47 am Post subject: |
|
|
Mike Wey wrote: | You would use it like this:
Code: | myModel.foreac(&foreachNodeFunc, null);
static extern(C) bool foreachNodeFunc(GtkTreeModel* model, GtkTreePath* path, GtkTreeIter* iter, void* data)
{
TreeModel treemodel = new TreeModel(model);
TreePath treepath = new TreePath(path);
TreeIter treeIter = new TreeIter(iter);
//Do something with the model/iter
} |
|
thanks. i was trying to implement it as GtkTreeModelForeachFunc. what a shame. _________________ mengu.net - some kind of monster |
|
Back to top |
|
|
Mike Wey
Joined: 07 May 2007 Posts: 428
|
Posted: Mon Apr 12, 2010 12:29 pm Post subject: |
|
|
That is a GtkTreeModelForeachFunc But i have to give it a name in this case foreachNodeFunc since it's called for each node, or did you mean something else? |
|
Back to top |
|
|
Mengu
Joined: 21 Mar 2010 Posts: 21
|
Posted: Mon Apr 12, 2010 12:31 pm Post subject: |
|
|
Mike Wey wrote: | That is a GtkTreeModelForeachFunc But i have to give it a name in this case foreachNodeFunc since it's called for each node, or did you mean something else? |
my intention was getting all the iters in the liststore. _________________ mengu.net - some kind of monster |
|
Back to top |
|
|
|