I think this would help.
Thank you very much.
Philip Van Hoof wrote:
On Thu, 2008-02-14 at 15:27 +0800, Marc Glenn wrote:
Hello everyone,
Does anyone know how to retrieve values currently displayed on a
TreeView widget?
Suppose a row entry from the TreeView was clicked, how can the the
data in the row be retrieved?
I checked the Mono Documentation but I can't find a method to do this.
There are a few ways, but this is one possibility:
treeview.Selection.Changed += OnSelectionChanged;
private void OnSelectionChanged; (object o, EventArgs args)
{
Gtk.TreeSelection selection = o as Gtk.TreeSelection;
YourColumn'sType data;
Gtk.TreeModel model;
Gtk.TreeIter iter;
if (selection.GetSelected (out model, out iter)) {
int column = YourColumnNumber;
GLib.Value val = GLib.Value.Empty;
model.GetValue (iter, column, ref val);
data = (YourColumn'sType) val.Val;
val.Dispose ();
}
}
Advise: check out the Model View Controller pattern in detail.
Change "YourColumn'sType" into "string" in case the data is a string.
_______________________________________________
Gtk-sharp-list maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list