TreeView multiple selection



Hi all,

I'm trying to transfer a selection between to treeviews : on is an
iconview the other is a treeview, both of them uses the same model.
Each of these view are on different page of the same notebook, so the
user can choose what kind of display he wants.
To transfert the selection between the two views,  I try to set the
treeview.selection mode to MULTIPLE and add my iters to the treeview
selection, but it behaves very strangely: 
-most of the time only one item is finaly selected in the treeview
whereas there are multiple items selected in the iconview
-sometime 2 or more items are selected but never the complete selection
is selected ...
-sometimes only the last item of the iconview selection is selected on
the treeview.

Here is the code inserted in the callback on_iconview_selection_changed:

GtkTreeSelection *treeselection;
GList           *seliconview;
GList           *listrunner;
GtkTreePath     *path;
GtkTreeIter     iter;

Treeselection=gtk_treeview_get_selection(mytreeview);
Gtk_tree_selection_unselect_all(treeselection);
Gtk_tree_selection_set_mode(mytreeview,GTK_SELECTION_MULTIPLE);

Seliconview=gtk_iconview_get_selected_items(myiconview);

If(g_list_lenght(selinconview)>0)
{
        Listrunner=g_list_first(seliconview);
        While(listrunner)
        {
                Gtk_tree_model_get_iter(treemodel_of_iconview, &iter,
path);
                Gtk_tree_selection_select_iter(treeselection,&iter);
                Listrunner=g_list_next(seliconview);
        }
        G_list_foreach(listrunner,(GFunc) gtk_tree_path_free,NULL);
        G_list_free(listrunner);
}
G_list_foreach(seliconview,(GFunc) gtk_tree_path_free,NULL);
G_list_free(seliconview);


Can someone help me please ? I wound be very surprised and disappointed
if one couldn't select more than one item in a treeview .



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