[Glade-users] single click treeview selection question



Hello,

I am trying to print the value selected in a treeview after the user
single clicks a row in a treeview. unfortunately the:

        if (gtk_tree_model_get_iter(model, &iter, path))

line in my code below always is false, even though there is a row
selected. How can I return the selected row on a single click? 

(PS I am able to do this for a double click event, single click alludes
me)

thanks,
Kim




gboolean on_treeview1_button_release_event(GtkTreeView        *treeview,
                       GtkTreePath        *path,
                       GtkTreeViewColumn  *col,
                       gpointer            userdata)
  {
    GtkTreeModel *model;
    GtkTreeIter   iter;

    g_print ("A row has been clicked!\n");

    model = gtk_tree_view_get_model(treeview);

    if (gtk_tree_model_get_iter(model, &iter, path))
    {
       gchar *name;

       gtk_tree_model_get(model, &iter, COL_A, &name, -1);

       g_print ("Single clicked row contains name %s\n", name);

       g_free(name);
    } else {
                printf("\n no tree model");
        }
        return TRUE;
  }     




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