[Gtk-sharp-list] TreeModelAdapter hangs with my TreeModelImplementor class
Christian Hoff
christian_hoff at gmx.net
Sun Mar 7 08:57:15 EST 2010
I have already written such a TreeModel years ago and later revamped it
to handle all lists implementing the IList interface(Collections,
DataView, ..) with the appropriate columns (see attached file). I hope
this helps :-) .
Still I would like to see something like this into Gtk# trunk as this is
in my opinion one of the essential features that the binding is still
lacking. I don't want know how many people transfer the elements of .NET
ILists into a Gtk.ListView. I will talk to Mike (the Gtk# maintainer)
again and see what we can do. IMO, such a tree model would be a really
nice addition for Gtk# 3.0.
Christian
b0rg wrote:
> Hi
>
> This is my first post here. I'm moving from VS2005 to MonoDevelop and I try
> to make some controls based on GTK#, that are more familiar with that I used
> to work with. But I have very little experience with GTK.
>
> I've been looking around in various posts on how to make a custom adapter
> for a TreeView (in fact using a System.Data.Dataview) so I implement a
> TreeModelImplementor with this:
>
> http://n4.nabble.com/file/n1583443/GDataViewStore.cs GDataViewStore.cs
>
> and I use this class with this:
>
> this.myTreeView.Model = new TreeModelAdapter(new
> GDataViewStore(this.dView));
>
> Everything works unexpectedly well if dataview has rows, but if dView is
> empty (dView.Count==0) it hangs until it is killed by OOM killer. It seems
> that IterNext is called forever.
>
> If I change IterNext and check that there are no rows in dataview with this:
>
> public bool IterNext (ref Gtk.TreeIter iter)
> {
> if(dview.Count == 0) return false; // If dataview is empty, there is
> nothing next
> int rowindex = GetRowByIter(iter);
> if(rowindex == dview.Count - 1)
> return false;
> else {
> iter = GetIterByRow(rowindex + 1);
> return true;
> }
> }
>
> I get a
> Gtk-CRITICAL **: file /build/buildd/gtk+2.0-2.18.3/gtk/gtktreeview.c: line
> 5944 (validate_visible_area): assertion `has_next' failed.
> There is a disparity between the internal view of the GtkTreeView,
> and the GtkTreeModel. This generally means that the model has changed
> without letting the view know. Any display from now on is likely to
> be incorrect.
>
> and an out of range exception in GetValue.
>
> Is there a right way to do this?
>
> Forgive my long post, I would appreciate your assistance.
>
> Thanks
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: IListStore.cs
Type: text/x-csharp
Size: 10238 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20100307/61f0db06/attachment-0001.bin
More information about the Gtk-sharp-list
mailing list