[Gtk-sharp-list] Update row cells

Michael Hutchinson m.j.hutchinson at gmail.com
Sat Nov 11 11:33:38 EST 2006


On 11/11/06, Toño <ikaparamono at gmail.com> wrote:
>
> Hi all,
> It's the first time I post in a mailing-list... I hope to do it well.
> My problem is I have a Gtk.Treeview. I have added some columns. I have
> added some rows. But what I want is to modify a row cell. For
> instance...
>
> Name            Place           Speed
> =========================================
> John            London          34kbps
> Bill            London          12kbps
> John            New York        45kbps
>
> What I want is to modify the speed cell of each row. Names or places can
> be the same so... I have to identify the row object somehow.
> In WinForms I could use row.Tag = Objet to identify my objet, but I'm
> not sure how to do it in Gtk.

The GTK/TreeView works a bit differently to WinForms. In concept, it's
a bit like the TreeView is databound to a TreeModel-implementing
object such as TreeStore or ListStore.

For your purposes all you need to do is to have a columns in the
TreeModel that is not displayed in the TreeView.
More info at
http://www.go-mono.com/docs/monodoc.ashx?tlink=5@ecma%3a1315%23TreeModel%2f

Also, there's a more .NET-ish subclass called NodeView/NodeStore that
lets each row be an arbitrary object.
http://www.go-mono.com/docs/monodoc.ashx?tlink=5@ecma%3a1049%23NodeView%2f
http://www.go-mono.com/docs/monodoc.ashx?tlink=5@ecma%3a1048%23NodeStore%2f

-- 
Michael Hutchinson
http://mjhutchinson.com


More information about the Gtk-sharp-list mailing list