Here's a more complex tree, some of of the files in
my music collection. (It's not exactly how GTK would show it, but
close enough.) ── misc │ ├── PiSymphony │ │ ├── Pi-and-e.ogg │ │ └── The-Circle.ogg │ └── SovietArmy │ ├── 01 - Song of Youth.mp3 │ ├── 02 - A birch tree in a field did stand.mp3 │ ├── 03 - Far Away.mp3 │ ├── 04 - Song of the Volga Boatmen.mp3 │ ├── 05 - You are always beautiful.mp3 │ ├── 06 - Along Peter's Street.mp3 │ ├── 07 - Tipperary (sung in English).mp3 │ ├── 08 - Ah! Lovely Night.mp3 │ ├── 09 - Kamarinskaya [instrumental].mp3 │ ├── 10 - Annie Laurie (sung in English).mp3 │ ├── 11 - Song of the Plains (Meadowland).mp3 │ ├── 12 - Kalinka.mp3 │ ├── 13 - Bandura (sung in Ukrainian).mp3 │ ├── 14 - Oh no, John! (sung in English).mp3 │ ├── 15 - Snowflakes.mp3 │ ├── 16 - Ukrainian Poem.mp3 │ └── 17 - Soldiers' Chorus (from The Decembrists).mp3 └── synthesiser ├── Carlos │ ├── Aurora_Borealis.ogg │ ├── Midnight_Sun.ogg │ └── SonicSeasonings.ogg ├── Hyman │ ├── Evening_Thoughts.ogg │ ├── Four_Duets_in_Odd_Meter.ogg │ ├── Give_It_Up_or_Turn_It_Loose.ogg │ ├── Improvisation_in_Fourths.ogg │ ├── Kolumbo.ogg │ ├── Tap_Dance_in_the_Memory_Banks.ogg │ ├── The_Legend_of_Johnny_Pot.ogg │ ├── The_Minotaur.ogg │ ├── The_Moog_and_Me.ogg │ ├── Time_Is_Tight.ogg │ ├── Topless_Dancers_of_Corfu.ogg │ └── Total_Bells_and_Tony.ogg ├── Kitaro │ ├── Silk_Road_II.ogg │ └── Silk_Road_I.ogg ├── Tomita │ ├── Compilation On 08/10/2018 14:48, Igor Korot wrote:
On Mon, Oct 8, 2018 at 12:11 PM Chris Moller <moller mollerware com> wrote:Hi, Igor, The row-activated handler calls: void user_function (GtkTreeView *tree_view, GtkTreePath *path, GtkTreeViewColumn *column, gpointer user_data) { } so what you need is : gint *indices = gtk_tree_path_get_indices (path); which will return an integer vector ow the row, column, sub-column, subsub-column... depending on the topgraphy of your tree. (You can get the depth of the tree--thus the number of entries in the vector--with: gint len = gtk_tree_path_get_depth (path); ) If it's a simple two-dimensional tree, the column number will be indices[1], but you might want to make sure that the tree depth is at least two before doing that or you might be pointing past the end of the indices array.BTW, what do you mean by saying: "simple 2-dimensional tree"? Is there going to be n-dimensional tree? How it will be represented on the screen? Do you have a screenshot? Thank you.By the way, don't try to free the indices array--it points to a GTK internal structure. HTH, Chris On 08/10/2018 12:52, Igor Korot wrote: Hi, Chris, On Sun, Oct 7, 2018 at 3:34 PM Chris Moller <moller mollerware com> wrote: Take a look at gint * gtk_tree_path_get_indices (GtkTreePath *path); with the "GtkTreePath *path" parameter you get from the row-activated callback. https://developer.gnome.org/gtk3/stable/GtkTreeModel.html#gtk-tree-path-get-indices I tried to do: int column = gtk_tree_path_get_indices( column ); but got an error: Can't convert GtkTreeViewColumjn to GtkTreePath The "row-activated" callback is defined as: void user_function(GtkTreeView *tree_view, GtkTreePath *path, GtkTreeViewColumn *column, gpointer user_data); And so the types are unrelated. What am I doling wrong? Thank you. On 07/10/2018 20:04, Igor Korot via gtk-list wrote: Hi, ALL, For the GtkTreeView there is a "row-activated" signal: https://developer.gnome.org/gtk3/stable/GtkTreeView.html#GtkTreeView-row-activated. That function receives as a parameter column the GtkTreeViewColumn in which the activation occurred. The problem is (at least as I see it) is that it is not a simple integer for the column number. Is there a simple way to get a column number on which I activated the row from this signal? Thank you. _______________________________________________ gtk-list mailing list gtk-list gnome org https://mail.gnome.org/mailman/listinfo/gtk-list _______________________________________________ gtk-list mailing list gtk-list gnome org https://mail.gnome.org/mailman/listinfo/gtk-list |