Re: How to get a string from treeview



On Fri, Feb 07, 2003 at 02:31:40PM +0100, David Goncalves wrote:

       If i click on row 1 i want to get "bar" in a gchar * ;)

The get_selected method will work if you already know what column you want
your data from.

In general, you can get the x and y coords from the event structure and then
use gtk_tree_view_get_path_at_pos(), which gives you the path, the
TreeViewColumn and some other stuff.  If the TreeModel columns match the
TreeViewColumns you can just do a linear search to get the column number:

for(i=0; gtk_tree_view_get_column(i)!=view_column; i++)

or set the column number on the TVC with set_data when adding the TVCs to
the TreeView.

Then use gtk_tree_model_get_value() to get the value.

Dave Cook



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]