Dragging multiple objects from a TreeView



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Sorry folks, I must be sitting on my brains.

I have a GtkTreeView, from which I want to drag (possibly) multiple
(selected) rows. This is a sketch of the code so far:

  | GtkTreeView *itlist;
  ...
  | itlist_fill(GTK_WIDGET(itlist), dbh);
  | /* This is to populate the palettes: */
  | gtk_tree_view_enable_model_drag_source(itlist,
  |                                        GDK_BUTTON1_MASK,
  |                                        roomkey_droptypes,
  |                                        G_N_ELEMENTS(roomkey_droptypes),
  |                                        GDK_ACTION_LINK);
  | 
  | gtk_tree_selection_set_mode(gtk_tree_view_get_selection(itlist),
  |                             GTK_SELECTION_MULTIPLE);
  | 
  | g_signal_connect((gpointer) itlist, "drag_data_get",
  |                  G_CALLBACK(on_itlist_drag_data_get),
  |                  NULL);

and the function on_itlist_data_get() prepares a "package" containing
info on the selected items.

All works dandy, I can select multiple rows (with CTRL- and SHIFT- as
usual), and drag them to another widget, but there's a snag: when I
click onto the GtkTreeView to start the drag, the selection is gone! :-(

(I still can test the approach by holding e.g. CTRL at the start of the
drag and letting go before the drop).

Is there a standard way to cope with that? What do you do in this cases?

Thanks
- -- tomÃÂs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFER9jBcgs9XrR2kYRAncRAJ45fQl8EEaFUDHJoj4ZwaW2psZ0zACfQfUZ
zq2Zse62Mm2Upc/XOvyleP4=
=Abyl
-----END PGP SIGNATURE-----




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