On Mon, Oct 8, 2018 at 12:11 PM Chris Moller <mol...@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 <mol...@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
>
>
_______________________________________________
gtk-list mailing list
gtk-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-list

Reply via email to