Re: How to get the real selection order in a tree view?



On Tuesday 14 September 2004 23:56, you wrote:

Hi Jérôme,

Set up your own select function (note that it is called _before_ the
selection state of the row is toggled!), and keep your own list around.


I suppose that you are speaking about the function :
void gtk_tree_selection_set_select_function(GtkTreeSelection *selection,
                                             GtkTreeSelectionFunc func,
                                             gpointer data,
                                             GtkDestroyNotify destroy);

yes.

This doesn't seems to be easy to use as it also use the function when
unselecting a line.

one of the function parameters is a flag whether the line is currently 
selected, so you end up with something like:

gboolean
my_select_function (GtkTreeSelection *selection,
                               GtkTreeModel *model,
                               GtkTreePath *path,
                               gboolean path_currently_selected,
                               gpointer yourdata)
{
    if (path_currently_selected)
    {
         ..... going to be unselected => remove row from your own list .....
    }
    else
    {
         ..... going to be selected => add row to your own list .....
    }

    return TRUE; /* yep, allow selection/unselection to happen */
}


The last line selected must be stored somewhere as when using "the shift
kek + the mouse" it select the line from the *last selected line+ to the
newer one...

Doesn't it call the select function for each and every line in between those 
two if you select multiple lines? I think it does.

Cheers
 -Tim
 




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