Re: Getting row numbers

maybe this will help?  the following callback will get the row number of the row when double-clicked by the user.  basically, convert a GtkTreePath to a string.  you must take proper care if you have a tree deeper than one level.

void recordActivate(GtkTreeView *treeview, GtkTreePath *arg1, GtkTreeViewColumn *arg2, gpointer *hdrList)
{    // called when record double-clicked
    char    *row;
    int        rowNum;

    row = gtk_tree_path_to_string(arg1);
    rowNum = atoi(row);


On 5/9/07, David Nečas (Yeti) <yeti physics muni cz> wrote:
On Wed, May 09, 2007 at 01:38:04PM -0400, tj wrote:
> >
> Ok, so how do I get the row number, from GtkTreePath,

In general, the path is not a single number as it can
represent paths in trees too.  If you have a list, the path
consists of only one index though: the row number.

> from
> GtkTreeRowReference?

By converting it to GtkTreePath and continuing as above.

If you are not going to remove, move, ..., the selected
nodes, it is often easier to use gtk_tree_selection_selected_foreach().

> Where is it one of those. In fact, where are their
> struct defs? I look in /usr/include/gtk+-2.0 and All I find is thhe type
> def to it preceded by the '_'. But, no struct definition of
> _GtkTreeRowReference, etc.

Thou shalt not meddle with the internal representation.


gtk-list mailing list
gtk-list gnome org

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