diff --git a/doc/en/Gtk/TreeView.xml b/doc/en/Gtk/TreeView.xml
index 668c5c7c4..1b887a140 100644
--- a/doc/en/Gtk/TreeView.xml
+++ b/doc/en/Gtk/TreeView.xml
@@ -18,25 +18,9 @@
To create a tree or list in GTK#, you need to use the interface, in conjunction with the
widget. This widget is designed around a
Model/View/Controller design and consists of four major parts:
-
- -
-
- , the tree view widget
-
-
- -
-
- , the view column.
-
-
- -
- The cell renderers ( and others).
-
- -
-
- , the model interface.
-
-
+ - , the tree view widget
+
- , the view column.
+
- The cell renderers ( and others).
- , the model interface.
The View is composed of the first three, while the last is the
Model. One of the prime benefits of the MVC design is that
@@ -53,8 +37,7 @@
"False", "On" or "Off", or should you render it as a checkbox?
A simple list:
-
-
+
using System;
using Gtk;
@@ -97,11 +80,9 @@ public class TreeViewSample {
args.RetVal = true;
}
}
-
-
+
A more advanced example:
-
-
+
using System;
using System.Reflection;
using Gtk;
@@ -217,15 +198,15 @@ public class TreeViewDemo {
System.Environment.Exit (0);
}
}
-
-
+
For a example how to handle selection events, or to determine the currently selected row, see .
Gtk.Container
-
+
+
@@ -1139,7 +1120,63 @@ This property tells GTK# that the user interface for your application requires u
Raised when the cursor changes (rows).
-
+
+
+
+using Gtk;
+using System;
+
+class MainClass
+{
+ public static int Main (string[] args)
+ {
+ Application.Init ();
+
+ Window win = new Window("TreeView Cursor Changed Example");
+ win.DeleteEvent += OnWindowDelete;
+
+ TreeStore store = new TreeStore(typeof(string), typeof(string));
+ for (int i = 0; i < 5; i++)
+ store.AppendValues("demo " + i, "data " + i);
+
+ TreeView tv = new TreeView();
+ tv.HeadersVisible = true;
+ tv.Selection.Mode = SelectionMode.Single;
+
+ tv.AppendColumn("Demo", new CellRendererText(), "text", 0);
+ tv.AppendColumn("Data", new CellRendererText(), "text", 1);
+ tv.CursorChanged += OnCursorChanged;
+
+ tv.Model = store;
+
+ win.Add(tv);
+
+ win.ShowAll();
+ Application.Run ();
+
+ return 0;
+ }
+
+ static void OnWindowDelete(object obj, DeleteEventArgs args)
+ {
+ Application.Quit();
+ }
+
+ static void OnCursorChanged(object obj, EventArgs e)
+ {
+ TreeSelection selection = (obj as TreeView).Selection;
+
+ TreeModel model;
+ TreeIter iter;
+
+ // The iter will point to the selected row
+ if(selection.GetSelected(out model, out iter))
+ Console.WriteLine("Path of selected row = {0}", model.GetPath(iter));
+ }
+}
+
+
+