mail-archives/gtk-sharp-list/attachments/20061119/cd0325e7/attachment-0001.bin

42 строки
787 B
Plaintext

//
// compile with mcs -pkg:gtk-sharp-2.0 SelectIterTest.cs
//
using Gtk;
public class SelectIterTest
{
public static void Main (string[] args)
{
Application.Init ();
new SelectIterTest ();
Application.Run ();
}
public SelectIterTest ()
{
Window w = new Window ("SelectIterTest");
ScrolledWindow s = new ScrolledWindow ();
ListStore store = new ListStore (typeof (string));
TreeView view = new TreeView (store);
TreeIter iter = TreeIter.Zero;
for (int i = 0; i < 100; i++) {
iter = store.AppendValues (i.ToString ());
}
view.AppendColumn (new TreeViewColumn ("Number", new CellRendererText (), "text", 0));
s.Add (view);
w.Add (s);
w.ShowAll ();
// select, but don't scroll to, the last row
view.Selection.SelectIter (iter);
}
}