Treeview onrowactivated

hi

I have a problem with treeview onrowactivated on GTK 3.

There is onrowactivated when you double click a row.

I saw there is a variable to make onrowactivated work for single click a row.

But I need both! How can I do this? I need 2 functions: 1 for single click, 1 for double click and they must work together.

What do you want to do on single click? Normally, single click selects, so you’d watch the selection with the selection-changed signal.

Can you give a small code example how to make the `selection-changed attached to a treeview?

Oh, you linked to the docs for GtkIconView, and I zeroed in on that. For GtkTreeView, it’s similar, but there’s a separate GtkTreeSelection object with a changed signal.

The gtk3-demo main UI makes a pretty good example: demos/gtk-demo/main.c · gtk-3-24 · GNOME / gtk · GitLab

Note that it uses GtkBuilder to access the TreeSelection, but you can also use gtk_tree_view_get_selection().

That’s about all the time I want to spend thinking about TreeView. You should consider moving up to GTK4 with its new list widgets.

The example uses GTK4 but perhaps it can also be a role model for GTK3.

Greetings

Holger