Re: The cursor when dragging from a clist



Salvatore Valente a écrit :
> 
> I have a program that allows you to drag items from a clist to a
> drawing area.  While dragging, the cursor with becomes an arrow with a
> little document (a sheet of paper with a folded corner) under the
> arrow.  A document is not a particularly good representation of what's
> being dragged in this case.  How can I make the document picture go
> away?  (I'd like the dragging cursor to be just an arrow.)
> 
> I thought that gtk_clist_set_use_drag_icons(FALSE) would make
> the document go away, but it didn't seem to have any effect.
> 
> Alternatively, how can I change the document picture to some other
> picture?
I found a solution, but I am not sure it is a good way to do that.
I use ctree but clist is the same.
I connect the event signal to the ctree
  gtk_signal_connect (GTK_OBJECT (ctree), "event", GTK_SIGNAL_FUNC
(ctree_event), NULL);
then in my callback I send the signal drag with this
  static gint where_press;
  if (GASPARD_VERY_CHAT) g_print ("Enter in ctree_event\n");
  switch (ev->type) {
    case GDK_BUTTON_PRESS : {
      switch (ev->button.button) {
        case 1 : {
          drag_icon = gdk_pixmap_colormap_create_from_xpm_d (NULL, 
                        gtk_widget_get_colormap (mainApp_Window),
                        &drag_mask, NULL, GASPARD_DRAG_ICON);
          gtk_drag_source_set (ctree, GDK_BUTTON1_MASK, target_slot, 1,
                               GDK_ACTION_COPY|GDK_ACTION_MOVE);
          gtk_drag_source_set_icon (ctree, 
                                    gtk_widget_get_colormap
(mainApp_Window),
                                    drag_icon, drag_mask);
          gdk_pixmap_unref (drag_icon);
          gdk_pixmap_unref (drag_mask);
          gtk_signal_connect (GTK_OBJECT (ctree), "drag_data_get",
                              GTK_SIGNAL_FUNC (source_drag_data_get));
          gtk_signal_connect (GTK_OBJECT (ctree), "drag_data_delete",
                              GTK_SIGNAL_FUNC (source_drag_data_delete),
key);
          }
        }
      }
    }

And that is all I have to do. The advantage of this method is that you
can have a
different icon, for every different line in the clist
Hope this help
-- 
Florent DEVIN




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