FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

About GtkTreeModelForeachFunc

 
Post new topic   Reply to topic     Forum Index -> gtkD
View previous topic :: View next topic  
Author Message
Mengu



Joined: 21 Mar 2010
Posts: 21

PostPosted: Sat Apr 10, 2010 8:55 am    Post subject: About GtkTreeModelForeachFunc Reply with quote

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
View user's profile Send private message
Mengu



Joined: 21 Mar 2010
Posts: 21

PostPosted: Sat Apr 10, 2010 6:28 pm    Post subject: Reply with quote

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
View user's profile Send private message
Mike Wey



Joined: 07 May 2007
Posts: 428

PostPosted: Sun Apr 11, 2010 8:10 am    Post subject: Reply with quote

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
View user's profile Send private message
Mengu



Joined: 21 Mar 2010
Posts: 21

PostPosted: Sun Apr 11, 2010 11:47 am    Post subject: Reply with quote

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. Sad
_________________
mengu.net - some kind of monster
Back to top
View user's profile Send private message
Mike Wey



Joined: 07 May 2007
Posts: 428

PostPosted: Mon Apr 12, 2010 12:29 pm    Post subject: Reply with quote

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
View user's profile Send private message
Mengu



Joined: 21 Mar 2010
Posts: 21

PostPosted: Mon Apr 12, 2010 12:31 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> gtkD All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group