Selection with simple click on GtkTreeView



Hi GTK community,

i have a problem with selection GtkTreeView. I can't get the content of (unique) row selected with a simple click. I have to get te content when i press a button, but my function returns all the time the content of the first row. Here my function :

gchar*
get_entry_list (GtkTreeView *TreeView, gint Cols)
{
    GtkTreeModel *Model = gtk_tree_view_get_model (TreeView);
    GtkTreeSelection *Select = gtk_tree_view_get_selection (TreeView);
    gtk_tree_selection_set_mode (Select, GTK_SELECTION_SINGLE);
    GtkTreeIter pIter;
    gchar *ID = NULL;


    if (gtk_tree_selection_get_selected (Select, &Model, &pIter))
    {
    gtk_tree_model_get (Model, &pIter, Cols, &ID, -1);
    }

    return ID;
}

How i can do ? Maybe it's because the lost of focus on GtkTreeView ?

Thks.

Alex.


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