Re: [pygtk] Selection issues with TreeModelSort

2004-03-11 Thread David M. Cook
On Thu, Mar 11, 2004 at 04:43:33PM -0700, Don Allingham wrote:

> I have created a custom tree model, derived from GenericTreeModel. I use
> text strings as iters for the model. This is working well. When I get
> the current selection, I get the string that I was using as an iter.
> 
>model = MyModel()
>tree.set_model(model)
>selection = tree.get_selection()
> 
>return_is_string = selection.get_selected()

I don't see how that works, it sounds like a fortuitous bug.  In C, a
TreeIter is an opaque structure.  You should still have to do a get_value to
get an actual usable value.

Dave Cook
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] Selection issues with TreeModelSort

2004-03-11 Thread Don Allingham
I have created a custom tree model, derived from GenericTreeModel. I use
text strings as iters for the model. This is working well. When I get
the current selection, I get the string that I was using as an iter.

   model = MyModel()
   tree.set_model(model)
   selection = tree.get_selection()

   return_is_string = selection.get_selected()

However, if I use the TreeModelSort to create a sortable model, then
getting the selection returns a GtkTreeIter, instead of the expected
string.

   model = MyModel()
   sort_model = gtk.TreeSortModel(model)
   tree.set_model(sort_model)
   selection = tree.get_selection()

   return_is_iter = selection.get_selected()

I was expecting to get the string I was using as an iter, not a generic
GtkTreeIter.

Is this the expected behavior? If it is, how do I convert the iter to
something that is meaningful? The convert_iter_to_child_iter method only
returns another GtkTreeIter.

Don

-- 
Don Allingham <[EMAIL PROTECTED]>
GRAMPS - Open Source Genealogy

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/