[Gtk-sharp-list] Databindig IList to a Gtk.TreeView

Philip Van Hoof spam at pvanhoof.be
Mon Apr 24 14:49:20 EDT 2006

On Mon, 2006-04-24 at 19:48 +0200, mlgs wrote:

> > Know what, try to catch me on IRC and I'll give you credentials with
> > commit permissions. My nickname is pvanhoof. I'm for example on the
> > #mono channel (if I'm awake).
> > 
> I'm not really irc person:) and currently I'm absent without permanent
> internet link for next two months, but I'll see what I can do about it.

Oh okay. Just mail me a username and password then. pvanhoof at gnome
dot org or any E-mail address you find on me.

> > That's for everybody who's interested in such a SVN account and/or
> > planning to tryout things with the code.
> is it really sane to have it outside of gtk-sharp?

No but. Mike Kestner was not allowed to use a keyboard this weekend (ask
him, and his wife), so he didn't yet take a look at it. I don't know
whether or not it's already ready for inclusion in a future Gtk-Sharp

I think it needs some more features and improvements. But your work
which made it work with combo boxes is a nice step into that direction,
I guess.

> ok, here's the patch I talked about.

There's still some problems with the patch. But what the heck .. it's a
experimental repository and it's a prove of concept. So I committed it.
> it includes ComboBox and ComboBoxEntry besides that little and still
> problematic state restore on treeview (yes, in my opinion it should be
> part of the main class, reasons below).

I'll checkout the implementation ;-)

> even after implementing them, ComboBox and ComboBoxEntry still had one
> problem that bugged me for half of hour trying to discover the reason
> (reason was you were allowing one item to few in nth_child_cb, probably
> when copy/pasting code from next_cb, damn, I really hate such things).

Yeah, I hate such things too. Good that you decided to fix it. Thanks.


> applied model callbacks seemed to ask for item 0 when they are in fact
> asking for the last. this loss of time is probably the reason why
> ComboBox handling with keyboard seems problematic (works fine with
> mouse, but when you press KEYDOWN for example you get SIGSEGV about
> combo not being able to obtain model). But since this is more or less
> proof of case, I'll be fine with it for now. any suggestion is
> appreciated, this is my first gui work after 9 years of strictly console
> services coding, so if you have any idea, don't hesitate because I'm
> looking in the dark (kicking the fog or whatever) on this one.

> another thing that bugs me is how do I know which level I'm asked on
> has_child_cb. only one index, no treepath, nothing??? I would like to
> make discovery there and if another IList object is on that spot also
> return valid answer (one way would be handling opened and closed nodes
> and iterating trough, but that seems more or less like pain in the ass).
> nice example of this is xml document, where all children are also
> xmlnodes, this way complete tree structure could be passed trough
> datasource in one pass. (again, I would appreciate any kind of info
> here)

I'll be honest here, and humbly tell you I never did a custom tree store
implementation myself. So far I only ever implemented custom list store

There's a few samples and applications that do implement a custom tree
store model. For example NodeStore.cs is one such tree store implemen-

> - reasons for treeview restore

> as you see I'm applying this only in case when applied DataSource is the
> same as DataSource before.


> resetting selection and viewport after adding a new member goes against
> any kind of HIG. well, to be truth full my software-s are always having
> interaction from the operating system and one can't know when item will
> be added, and destroying selections and moving viewpoint on fly is not
> what one would call HIG design.

I agree

> - plans for this test case
> making one more interface besides IList, list that supports cursors (my
> plan is having ICursor interface that points to object being binded to
> controls) and change notifications which could then be used to bind form
> controls directly on the selected object in IList (or as a matter of
> fact any object). well that's my idea for now.

Sounds good. If it supports both, that is. Else another adaptor and let
the TreeViewAdaptor support both ListAdaptor and CursorAdaptor?
Something like that.

It would be nice if it would be possible to implement ICursor as a type
that can work with database cursors. Combined with the fact that the
view will only request visible rows from the store, in case the fixed
row size property is set (regretfully only in that case): That would
simply be a killer feature for me. I'd be happy to investigate and
experiment that a little bit together.

> this would for example make possible to select multiple items, hit edit
> and all is just plain working. at least I need that in my project.

Oh, right. Another use-case I guess.

> > You may of course put a new such type in SVN once you have the
> > credentials / the account (in case the feature is better implemented in
> > a new type).
> > 
> > > I plan to try making the same thing for Combo.
> > 
> > Okay.
> > 

> so, I did it;)

Nice. It's committed. Ask me for a SVN account ;-). Send me some
password and username. You'll get a simple .htaccess-like apache2
authentication so it's okay that the password goes over plain-text
Philip Van Hoof, software developer at x-tend 
home: me at pvanhoof dot be 
gnome: pvanhoof at gnome dot org 
work: vanhoof at x-tend dot be 
http://www.pvanhoof.be - http://www.x-tend.be

More information about the Gtk-sharp-list mailing list