Associate user_data to a row in GtkTreeView



Hello

I want to associate some data to each row in a GtkTreeView which is not showed to the user. A common example would be, that I show the rows in a table from a database, but not the uniqe ID.

When a row is selected I can get the data in the row by something like this:

if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection(listWidget), &model, &iter)) {
   gchar *data;
   gtk_tree_model_get(model, &iter, STRING_COLUMN, &data, -1);
g_print ("You selected %s\n", data);

However I would much rather know what ID was selected rather than which data i showed the user. Is it possible to associate some user_data to the row, and does anyone have an example on how to do that?

Best regards, Søren



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