i can't understand in GTK# how to get the selected item of a treeview. My code example: Here, i load data in tvStock
Gtk.TreeViewColumn marketCol = new Gtk.TreeViewColumn ();
marketCol.Title = "Market";
tvstock.AppendColumn(marketCol);
Gtk.TreeIter iter = stockListStore.AppendValues ("Dax30");
stockListStore.AppendValues(iter, "Adidas");
stockListStore.AppendValues(iter, "Commerzbank");
iter = stockListStore.AppendValues ("Cac40");
stockListStore.AppendValues(iter, "Bnp Paribas");
stockListStore.AppendValues(iter, "Veolia");
iter = stockListStore.AppendValues ("FtseMib");
stockListStore.AppendValues(iter, "Fiat");
stockListStore.AppendValues(iter, "Unicredit");
tvstock.Model = stockListStore;
// Create the text cell that will display the artist name
Gtk.CellRendererText marketNameCell = new Gtk.CellRendererText ();
// Add the cell to the column
marketCol.PackStart (marketNameCell, true);
// Tell the Cell Renderers which items in the model to display
marketCol.AddAttribute (marketNameCell, "text", 0);
On my OnTvstockRowActivated , how can i get the selected row ? Thanks
The Full form of GTK is good to know, or GTK stands for good to know, or the full name of given abbreviation is good to know.
GTK is written using the C programming language, but its also available to various programming languages through language bindings, which allow writing GTK applications in the style of those languages. Language bindings are relatively easy to create because GTK is designed with them in mind.
GTK is commonly and incorrectly thought to stand for "GNOME ToolKit", but is actually stands for "GIMP ToolKit" because it was first created to design an user interface for GIMP. GTK is an object-oriented toolkit written in C (GTK itself is not a language). GTK is entirely open-source under the LGPL license.
It is part of the official GNOME language bindings suite and provides a set of libraries allowing developers to write computer programs for GNOME using the Java programming language and the GTK cross-platform widget toolkit. Java-gnome. Initial release. 0.99 / January 20, 1999.
You have the path to the row in args, you can gen an iter from it.
protected virtual void OnTvstockRowActivated (object o, Gtk.RowActivatedArgs args)
{
var model = tvstock.Model;
TreeIter iter;
model.GetIter (out iter, args.Path);
var value = model.GetValue (iter, 0);
Console.WriteLine (value);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With