Re: How to build a GtkTree?



On Sat, May 26, 2007 at 04:17:58PM +0200, Guenther Meyer wrote:
Am Samstag 26 Mai 2007 schrieben Sie:
You need to insert rows with parents.
Take a look at the definition of:
gtk_tree_store_insert ()

if parent is null, the row will be a "root" row... if parent is
non-null the row will be a child of parent.

Yes, I know that. Maybe I have asked the wrong question...

The problem is, I don't know the iter of the parent entry, that I have to use.

You know it.  In the example it's either the same parent
iter as you used in the last insertion or it is the iter you
*obtained* in the last insertion.  If you want to go up
a level, use gtk_tree_model_iter_parent().

Wwhat I need  is the iter to a given entry; to say it in sql-style:

  SELECT iter FROM tree WHERE content="someparententry";

How would you express content="someparententry"?

after that I can use the result value as parent for the new 
gtk_tree_store_insert statement.

Is there a function for this, or did I miss something.

If you want to search the whole tree using some custom
condition, use gtk_tree_model_foreach().  That's not exactly
efficient to do repeatedly though.  If you can tell on each
tree level what to look for (i.e. you don't have to search
all leafs), you can easily walk through the tree and always
descend one level when you find what you are looking for on
that level -- AFAIK there's no function for that, it would
be probably equally complicated to use as walking though the
tree manually...

Yeti

--
http://gwyddion.net/



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