Re: Get column no. of edited cell.



On 06/02/13 12:49, Arnel A. Borja wrote:
On Sunday, 02 June, 2013 02:15 PM, dE wrote:
I'm trying this out, but isnt this also possible with gtk_tree_view_get_cursor clubbed with gtk_tree_view_column_get_sort_column_id.

Cause I'm getting segfault with --

gtk_tree_view_get_cursor ( detect_object ( "DataDisplay", build_object ), tree_path, focus_column );

Where --

GtkTreeViewColumn **focus_column;
GtkTreePath **tree_path;

This is what the documentation says about the parameters of gtk_tree_view_get_cursor (https://developer.gnome.org/gtk3/stable/GtkTreeView.html#gtk-tree-view-get-cursor):
/|
tree_view|/ : A GtkTreeView
/|path|/ : A pointer to be filled with the current cursor path, orNULL.*[**out**]*[transfer full][allow-none] /|focus_column|/: A pointer to be filled with the current focus column, orNULL.*[**out**]*[transfer full][allow-none]

Noticed the [out] in path and focus column? That means you have to pass the pointers to a (GtkTreeViewColumn *) variable and a (GtkTreePath *) variable, instead of passing a (GtkTreeViewColumn **) variable and a (GtkTreePath **) variable.

You may do something like this then:

GtkTreeViewColumn *focus_column;
GtkTreePath *tree_path;

gtk_tree_view_get_cursor ( detect_object ( "DataDisplay", build_object ), &tree_path, &focus_column );

Now focus_column and tree_path contains the currently focused column and path to its row, respectively.

Yes, now it works. Thanks!

However, it appears that this is not something suitable for the task, since this particular event "edited" (GtkCellRender) is triggered after the editing has finished. As a result, I get -1 with gtk_tree_view_column_get_sort_column_id (focus_column).

So I've tried out your original technique, but I'm having some issues there --

I'm comparing the passed over GtkCellRenderer * with all renderers as such --

    while ( mod_renderer != *(renderer + i) )
        i++;

Where mod_renderer is the passed over GtkCellRenderer and renderer is  --

GtkCellRenderer **renderer;

and allocated memory via --

GtkCellRenderer **renderer = g_malloc (sizeof (GtkCellRenderer*) * 2);
    renderer[0] = gtk_cell_renderer_text_new ();
    renderer[1] = gtk_cell_renderer_text_new ();

I'm getting sefault in the while loop.


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